#P464. 【例84.1】 取余运算

【例84.1】 取余运算

Description

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

Input Format

Input the values of bb, pp, and kk.

Output Format

Calculate and output the value of bpmodkb^p\mod k.

Sample

2 10 9
2^10 mod 9=7