cheesecake is playing a mobile game where the goal is to spread a disease across the world. At any point in time, he may infect a healthy person with the pathogen, creating a patient zero. This pathogen spreads very quickly. Specifically, the number of infected people increases by a factor of
each day, with the game starting on day
.
cheesecake is trying to complete a very delicate mission in which he has to infect exactly
people over a course of
days. In other words, there must be exactly
infected people on day
. Help him find the minimum number of patient zeros he would have to create to complete his mission.
Constraints
For all subtasks:



Subtask 1 [20%]

Subtask 2 [20%]

Subtask 3 [60%]
No additional constraints.
Input Specification
The only line of input will have
,
, and
, separated by spaces.
Output Specification
Output the required answer, the minimum number of patient zeros cheesecake would have to create.
Sample Input 1
Copy
8 2 1
Sample Output 1
Copy
4
Sample Input 2
Copy
9 3 2
Sample Output 2
Copy
1
Sample Input 3
Copy
10 7 10
Sample Output 3
Copy
4
Explanation for Sample Outputs
In the first case, the optimal solution is to infect
people on day
.
In the second case, cheesecake should infect just one person on day
. On day
there will be
people infected. And on day
there will be
, as required.
In the third case, cheesecake should wait until day
, infect one person, then infect
more on day
.
Comments