int ksm(long long x,int n,int p) { int re=1; while(n) { if(n&1) re*=x%p; x*=x%p; n>>=1; } return re; }