#define LL long long LL qmul(LL a,LL b,LL mod){ LL ans = 0; for(;b;b>>=1){ if(b&1) ans = (ans+a)%mod; a = a*2%mod; } return ans; }