intqpow(int a, ll x, int mo) { int res = 1; while (x) { if (x & 1) res = 1ll * res * a % mo; a = 1ll * a * a % mo; x >>= 1; } return res; }
int fac[N], facinv[N]; voidprepare() { fac[0] = 1; facinv[0] = 1; for (int i = 1; i < N; i++) fac[i] = 1ll * fac[i - 1] * i % mod; facinv[N - 1] = qpow(fac[N - 1], mod - 2, mod); for (int i = N - 2; i >= 1; i--) facinv[i] = 1ll * facinv[i + 1] * (i + 1) % mod; } intC(int n, int i) { if (i == 0) return1; if (n <= 0) return0; if (i > n) return0;