Modular Exponentiation#273

Modular Exponentiation

1 second
128 megabytes
Very easy

Three positive integers , , and are given. Find the value of x^n \bmod m.

Input

The input contains three positive integers , , \left(1 \leq x, m \leq 10^9,\ 2 \leq n \leq 10^7\right).

Output

Print one integer — the value of x^n \bmod m.

Examples

Example 1

Loading
Loading