Hide

Problem B
Binary Exponentiation

Languages en is

You are given non-negative integers $a, e, m$ and should print $a^e \pmod{m}$.

Input

The first and only line of input contains non-negative integers $a, e, m \leq 10^{18}$ separated by a space. We also have $m \geq 2$.

Output

Print $a^e \pmod{m}$.

Sample Input 1 Sample Output 1
15 7 99
27

Please log in to submit a solution to this problem

Log in