#include<iostream>
using namespace std;
typedef long long LL;
int qmi(int a, int b, int p)
{
LL res = 1 % p;//p为1时,取余全为0
while(b)
{
if(b & 1)res = res * a % p;
a = (LL) a * a % p;
b >>= 1;
}
return res;
}
int main()
{
int a, b, p;
scanf("%d%d%d", &a, &b, &p);
printf("%d",qmi(a, b, p));
}

京公网安备 11010502036488号