1 #include<bits/stdc++.h> 2 3 using namespace std; 4 5 #define LL long long 6 7 int main(){ 8 LL a,b,m; 9 cin >> a >> b >> m; 10 LL ans = 1; 11 while(b){ 12 if(b & 1) ans = ans * a % m; 13 a = a * a % m; 14 b >>= 1; 15 } 16 cout << ans << endl; 17 return 0; 18 }