Modular division#9606

Modular division

1 second
128 megabytes
Easy

Three positive integers , , and are given. Compute the value of a~/~b~\bmod~n. In other words, find a value such that b \cdot x \equiv a \pmod{n}.

Input

Three positive integers , , (n \le 2 \cdot 10^9, 1 \le a, b < n). It is known that is a prime number.

Output

Print the value of a~/~b~\bmod~n.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading