ll ksc(ll a,ll b,ll mod) { a%=mod,b%=mod; ll ret=a*b-(ll)((long double)a*b/mod+0.5)*mod; return ret<0?ret+mod:ret; }