#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
const int N=1e5+10;
ll qmi(ll a,ll b, ll c)
{
int res=1;
while(b)
{
if(b&1) res=(ll)res*a % c;
b>>=1;
a=a*a%c;
}
return res;
}
int main()
{
IOS
ll a,b,c;
cin>>a>>b>>c;
cout<<qmi(a,b,c);
return 0;
}
快速幂的应用