eolymp
bolt
Try our new interface for solving problems
Problems

Покупка цветов

Покупка цветов

On Teacher's Day, Vasya decided to buy a bouquet of flowers. The store sells daisies for $a$ hryvnias per piece and gladiolus for $b$ hryvnias per piece ($a < b$). Vasya has $c$ 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 $c$ hryvnias. Help him calculate the cost of such a bouquet.

Input

Three integers $a$, $b$, $c$ ($1 ≤ a < b ≤ 100$, $0 ≤ c ≤ 1000$).

Output

Print a single number - the cost of the most expensive bouquet with the maximum number of flowers.

Time limit 1 second
Memory limit 64 MiB
Input example #1
2 3 11
Output example #1
11
Input example #2
3 5 10
Output example #2
9