e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

The Shortest does not Mean the S

The Shortest does not Mean the S

Your are given integer numbers A, B and C. Output the remainder of division AB (B-th power of A) by C.

Input
The only line of the input file contains three integers: A, B, C (1 <= A, B, C <= 1018). Numbers are separated by spaces.

Output
Output file must contain only one non-negative integer less than C - the answer to the problem.

Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3 4 5
Output example #1
1