Home => ProblemSet => Super A^B mod C
Problem2253--Super A^B mod C

2253: Super A^B mod C

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 0
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

Given A,B,C, You should quickly calculate the result of AB mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).

Input

There are multiply testcases. Each testcase, there is one line contains three integers A, B and C, separated by a single space.

Output

For each testcase, output an integer, denotes the result of AB mod C.

Sample Input Copy

3 2 4
2 10 1000

Sample Output Copy

1
24

Source/Category