One day Raju discovered USACO and from that day he would spend all his time solving problems. Laali was jealous to see Raju putting so much effort to solve problems about Farmer John’s cow Bessie.
So Laali wrote a problem about herself and asked Raju to solve it. Raju wrote the following solution only to realize it would take him very long to get any output and Laali will be highly disappointed.
take N and M as input
for i = 2 to 1,000,000,000,000
if i is equal to the smallest divisor of M and N >= i // 1 is not considered as a divisor
M = M / i
N = N - i
print N and M
Now given an initial N and M, help Raju so that he can solve the problem and save the world from the wrath of Laali.
Input contains two numbers N (1 ≤ N ≤ 1012) and M (1 ≤ M ≤ 1012) denoting the initial values.
Output a single line containing the final values of N and M.
Input | Output |
---|---|
10 30 | 0 1 |
Input | Output |
---|---|
10 10 | 3 1 |
Input | Output |
---|---|
9 30 | 4 5 |