e-olymp
Competitions

Power + Euler function

Modular Exponentiation

Find the value of expression ab mod m.

Input

Three positive integers a, b, m (1a, b109, 2m109).

Output

Print one number that equals to ab mod m.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3 100
Output example #1
8