Super calculator#2250

Super calculator

1 second
64 megabytes
Easy

Super calculator performs only a single arithmetic operation — multiplication of natural numbers. The upper boundary for the range of representable natural numbers in the calculator is unknown; let us denote this boundary by . If the result of multiplication a \cdot b is greater than or equal to (a \cdot b \geq P, where and are the factors), two scenarios are possible:

  1. The answer is (a \cdot b) \bmod P.

  2. The answer is a random number from the range of valid values (calculator malfunction).

Given the values of the factors (, ) and the result (), write a program to analyze the calculator's behavior. The output must be a single number determined as follows:

  1. , if c = a \cdot b;

  2. , if a malfunction occurred;

  3. the minimal value of .

Input

The input is a string containing the numbers , , and , separated by spaces. and are the factors, is the result.

Output

The output is a single number.

Note: The length of the input string does not exceed .

Examples

Example 1

Loading
Loading