#T356. 取余运算

取余运算

Description

Given the values of bb, pp, and kk, compute the value of bpmodkb^p \mod k. Here, bb, pp, and k×kk \times k are long integers.

Input Format

Input the values of bb, pp, and kk.

Output Format

Output the value of bpmodkb^p \mod k.

2 10 9

2^10 mod 9=7