//a*b%m
ll mul(ll a,ll b){
    ll s=0;
    for(;b;b>>=1){
       if(b&1) s=(s+a)%m;
    if(b-1) a=(a+a)%m;
    }
    return s;    
}