Problem Statement :
Hacky, went on a treasure hunt and he struck gold in El Dorado , miles away from home. It was a treasure chest, filled with coins. Delighted, he decided to return home immediately to spend it all on his beloved Cat. Being the noob that he is, he went on to buy a worthless tractor from the nearby City to help him carry all of it back home. Little did he know that the tractor, with its ridiculously low mileage was incapable of carrying all the coins in one go. And now, with petrol turning out to be one of the most expensive things on the planet (after women ofcourse), he had a hard time figuring out the best way to carry the it all back home, while minimizing his travel expenses.
Your task is to help out Hacky and his Cat calculate the maximum amount of coins he can bring back home given the distance between his home and El Dorado, the total number of coins in the chest, the total number of coins the tractor can carry without falling apart, and the amount of coins to be spent on petrol per kilometer.
Input Specifications :
The input spans over multiple lines, each line corresponding to a separate input set.
Each set consists of :
- The total number of coins (100<coins<100000).
- The distance from home in kilometers(100<Distance<100000).
- The amount of coins the tractor can carry in one go (100<Amount<100000).
- The amount of coins spent per kilometer(1<Mileage<100000).
Output Specifications :
Print out a single line stating the maximum number of coins that can Hacky can bring back home (rounding off to the closest integer) and 0, if he cannot bring back any.
Sample Input :
1000 500 500 1
Sample Output :
Problem Setter : Vishnu Mohandas