Although she tries very hard, Cecilia Alcott is not the best at cooking. Luckily, to gain favor with Ichika, she doesn't need skills — she has money. Cecilia has secured a date with Ichika today, and so she is planning to treat him to a series of fancy restaurants over the course of this evening.
There are
Cecilia would now like to know at most how much of an impression she can make on Ichika this evening, if they dine at each restaurant at most once.
Input Specification
The first line of input will contain three integers,
The next
Output Specification
The output should be a single line, the most impression Cecelia can make on Ichika this evening, following the constraints explained above.
Constraints
Test Case Batch | Marks | Constraints |
---|---|---|
1 [10 cases] | 60 | |
2 [3 cases] | 30 | |
3 [3 cases] | 10 |
Sample Input 1
15 1 2
1 5 1
2 10 1
Sample Output 1
2
Explanation for Sample Output 1
Since Ichika becomes full after eating at any of the two restaurants, Cecilia should take him to the second one, because even if it takes twice as long to eat there as the first restaurant, it also yields twice the impression value.
Sample Input 2
120 10 3
10 30 5
25 70 3
30 90 4
Sample Output 2
40
Explanation for Sample Output 2
Cecilia should choose the first and third restaurants, using up all 120 minutes while making sure Ichika only gets 9 units of food. This results in the total value of 40.
Comments