Woburn Challenge 2018-19 Round 3 - Junior Division

Jessie, James, and Meowth, members of the honourable Team Rocket, have unfortunately fallen on hard times. With their funds necessarily allocated to constructing all manner of giant robots and other devices, they've been having difficulty affording any food lately. But that's nothing that an honest day's work can't fix!
James has a can of leftover paint, containing
James will produce as many badges as he can using the paint, using
exactly
There might still be some extra paint left over, once there's not enough
for another complete badge. However, there's no need for it to go to
waste - James will sell any remaining paint at a rate of
How much money will James make for Team Rocket in total, from his sales of badges and leftover paint? Hopefully it'll be enough for at least a loaf of bread!
Input Specification
The first line of input consists of a single integer,
The second line consists of a single integer,
The third line consists of a single integer,
Output Specification
Output a single integer, the amount of money which James will make (in Pokédollars).
Sample Input
14
3
10
Sample Output
42
Sample Explanation
James has enough paint for
Comments
This comment is hidden due to too much negative feedback. Show it anyway.