include[HTML_REMOVED]
using namespace std;
int main()
{
long long int a, b ,p;//一般都取ll
cin>>a>>b>>p;
int res = 1;
while(b)
{
if(b&1)res=resa%p;
b>>=1;
a =aa%p;//移位后更新
}
cout<<res%p<<endl;
}