#000045

z-stepen

Mr. Little Z has the following math problem. For the given numbers O, S, M he has to calculate the Sth exponent of number O, with modulus M.


Help Mr. Little Z calculate the result.


InputThe first and only line of the standard input contains the numbers O, S, M. (0 < O <= 2000000000), (0 < S <= 20000000000). (0 < M <= 4000).

OutputTo the standard output write one number that is the result of (O^S) mod M.

Input:
2 10 10
Output:
4
Explanation:
(2 ^ 10) mod 10 = 1024 mod 10 = 4

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.