lucas 快速求大数组合数
根据公式就是 对每次C(n,m) = C(n%p,m%p) * C(n/p,m/p);
ll pow(ll x,ll n) { ll res = 1; x%=mod; while (n) { if(n&1) res = res*x%mod; x = x*x %mod; n >>=1; } return res; } ll C(ll n,ll m) { if(n < m) return 0; // c(n,m) = n!/m!/(n-m)! ll res = 1; for(int i=1; i<=m; i++) { ll a = (n+i-m)%mod; ll b = i%mod; res = res*(a*pow(b,mod-2)%mod)%mod; } return res; } ll Lucas(ll n,ll m) { if(m == 0) return 1; return C(n%mod, m%mod) * Lucas(n/mod,m/mod)%mod; }