2 10 1000
For this input, the required output is 24.
24
3 5 100
For this input, the required output is 43.
43
2 0 1000000007
For this input, the required output is 1.
1
Given integers xxx, nnn, and mmm, compute xnmod mx^n \mod mxnmodm using fast exponentiation.
xnmx \quad n \quad mxnm
xnmod mx^n \mod mxnmodm