long long Mul(int n, int id){ if (n == 0) return 1; long long ans = 1; if (n / pk[id]) { for (int i = 2; i <= pk[id]; i++) if (i % exP[id]) ans = ans * i % pk[id]; // ans = pow_mod(TT[id][pk[id]], n / pk[id], pk[id]); } // ans = ans * TT[id][n % pk[id]] % pk[id]; for (int i = 2; i <= n % pk[id]; i++) if (i % exP[id]) ans = ans * i % pk[id]; return ans * Mul(n / exP[id], id) % pk[id];}int exlucas(int n, int m, int id){ if (n < m || n < 0 || m < 0) return 0; if (m == n || m == 0) return 1; long long a = Mul(n, id), b = Mul(m, id), c = Mul(n - m, id); int t = 0; for (int i = n; i; i /= exP[id]) t += i / exP[id]; for (int i = m; i; i /= exP[id]) t -= i / exP[id]; for (int i = n - m; i; i /= exP[id]) t -= i / exP[id]; return a * pow_mod(b, phip[id] - 1, pk[id]) % pk[id] * pow_mod(c, phip[id] - 1, pk[id]) % pk[id] * pow_mod(exP[id], t, pk[id]) % pk[id];}long long CRT(int *a, int *b, int n){ long long N = 1, Ni, now, ans = 0; for (int i = 1; i <= n; i++) N *= a[i]; for (int i = 1; i <= n; i++) { Ni = N / a[i]; now = pow_mod(Ni, phip[i] - 1, a[i]); ans = (ans + (b[i] * now % N) * Ni % N) % N; } return ans;}long long Calc(int n, int m){ if (n < 0 || m < 0 || n < m) return 0; for (int i = 1; i <= t; i++) { b[i] = exlucas(n, m, i); } return CRT(pk, b, t);}