Problems
Super calculator
Super calculator
Super calculator performs only a single arithmetic operation - multiplication of natural numbers. The upper limit of the range of representations of natural numbers in the calculator is not known. We denote this boundary \textbf{P}. If the result is greater than or equal to the multiplication of \textbf{P} (\textbf{a·b} ≤ \textbf{P}, \textbf{a}, \textbf{b} - factors), the two situations are possible:
\begin{enumerate}
\item The answer is \textbf{(a·b) mod P} .
\item The answer - a random number in the range of valid values (malfunctioning calculator).
\end{enumerate}
Given the values of the factors (\textbf{a}, \textbf{b}) and result (\textbf{c}). Required to write a program analysis of the calculator, which results in a single number that is generated by the following principle:
\begin{enumerate}
\item \textbf{0}, if \textbf{c = a·b};
\item \textbf{1}, if the failure occurred;
\item the minimum value of \textbf{P}.
\end{enumerate}
\InputFile
The string contains the numbers \textbf{a}, \textbf{b} and \textbf{c} separated by a space, \textbf{a} and \textbf{b} -- factors, \textbf{c} -- the result.
\OutputFile
This file contains a single number.
\textbf{Note}: small Vasya, who dreams of becoming a hacker managed to spy on the length of the line input does not exceed \textbf{15}.
Input example #1
4 5 20
Output example #1
0