A ^ B Problem

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

给定三个数AA, BB, KK, 求 AABB次方除以KK的余数 。

Format

Input

输入只有一行,为三个正整数A(1<=A<=1018A(1 <= A <= 10^{18}, B(1<=B<=2×1018)B(1 <= B <= 2×10^{18}), K(1<=K<=109)K(1 <= K <= 10^9)

Output

一个整数,(A(A ^ B)B) % KK 的值。

Samples

11 100 7
4

2025_SDNU_国庆纳新题单

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
20
Start at
2025-9-30 14:30
End at
2025-10-8 22:30
Duration
200 hour(s)
Host
Partic.
22