#include using namespace std; using ll=long long; using ld=long double; using P=pair; using V=vector; #define rep(i,n) for(ll i=0;i> n; while(n){ if(n%2) ans=ans*k%p; k=k*k%p; n/=2; } cout << ans << endl; }