12563: 人见人爱 A^BmodC  

Memory Limit:32 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:2 Solved:0

Description

计算 A 的 B 次幂对 c 取模(A^BmodC)并且 1<=A,B,C<=32768. 输入三个整数 A,B,C,输入文件每一行依次三个整数 a,b,c 用空格隔开 每行输出一个运算结果 

Input


Output


Sample Input Copy

3 4 5
10 10 100
45 67 89
5 55555555 3
6 12345678 123 

Sample Output Copy

1
0
45
2
90