F. Lũy thừa nhị phân


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Problem type
Mô tả

Cho ba số nguyên dương A, BP. Hãy tính giá trị của:

AB (mod P)

Dữ liệu vào
Dòng đầu tiên chứa ba số nguyên A, B, P.

1 ≤ A, P ≤ 10⁹
1 ≤ B ≤ 10¹⁸
Dữ liệu ra
In ra một số nguyên duy nhất là giá trị của A^B (mod P).
Ví dụ

Input

3 4 100

Output

81

Comments

There are no comments at the moment.