Decreasing Number
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
There are three types of operations that can be performed on an integer:
If the number is divisible by , divide it by ;
If the number is divisible by , divide it by ;
Subtract .
For a given positive integer , find the minimum number of operations required to obtain .
Input
Each line contains a single positive integer .
Output
For each value of , print the minimum number of operations required to obtain on a separate line.
Examples
Input #1
Answer #1
Submissions 12K
Acceptance rate 41%