e-olymp
Competitions

Power + Euler function

Modular Exponentiation

Three positive integers a, b and m are given. Find the value of ab mod m.

Input

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

Output

Find and print the value of ab mod m.

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