int modPow(int n,int k,int p){ if(k==0) return n%p; int ret=modPow(n,k/2,p); ret=(temp*temp)%p; if(k%2==1) temp=(temp*n)%p; return temp; }