- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi has a new job. As the first task in the job, he got a positive integer number and he has to transform it into . Uolevi can do two kinds of operations:
- Divide the number by and round down. This costs euros.
- Decrease the number by . This costs euros.
Find the minimum cost to transform the number into .
Input
The input contains three integers, , and .
Output
Output the minimum cost to transform the number into .
Constraints
Examples
Input:
3 5 3
Output:
8
Input:
5 10 1
Output:
5