Покупка цветов
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
On Teacher's Day, Vasya decided to buy a bouquet of flowers. The store sells daisies for hryvnias per piece and gladiolus for hryvnias per piece (). Vasya has hryvnias. He wants to make a bouquet of as many flowers as possible, and at the same time spend as much money as possible. In other words, from all the bouquets with the maximum possible number of flowers, he wants to choose the most expensive one, but not more expensive than hryvnias. Help him calculate the cost of such a bouquet.
Input
Three integers , , (, ).
Output
Print a single number - the cost of the most expensive bouquet with the maximum number of flowers.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 1K
Acceptance rate 25%