Divisor Increase
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
There is an integer . You are allowed to add to any of its divisors not equal to and . The same operation can be applied to the resulting number and so on. Notice that starting from the number , we can reach any composite number by applying several such operations. For example, the number can be reached starting from using operations: .
You have to solve a more general problem. Find the minimal number of the described operations necessary to transform into .
Input
Each line contains two integers and .
Output
For each test case, print in a separate line the minimal number of operations to transform into . Print if can't be obtained from .
Examples
Input #1
Answer #1
Submissions 168
Acceptance rate 19%