Problems

# Super calculator

Supercalculator performsonly a singlearithmetic operation- multiplicationof natural numbers.The upper limit ofthe range ofrepresentationsof natural numbersin the calculatoris not known.We denotethis boundaryP. If the result isgreater thanor equal to themultiplication ofP (a·bP, a, b - factors), thetwo situations are possible:

1. The answeris(a·b) mod P .
2. The answer -a random numberin the rangeof valid values (malfunctioningcalculator).

Giventhe values ​​ofthe factors (a, b) and result (c). Requiredto write a programanalysis ofthe calculator,which results in asingle numberthat is generatedby the following principle:

1. 0, if c = a·b;
2. 1, if thefailure occurred;
3. the minimum value ofP.

Input

The stringcontains thenumbersa, b and cseparated by a space, a and bfactors, cthe result.

Output

This file containsa single number.

Note: small Vasya, who dreams of becoming a hacker managed to spy on the length of the line input does not exceed 15.

Time limit 1 second
Memory limit 64 MiB
Input example #1
4 5 20

Output example #1
0