/****************************************** * AUTHOR: CHIRAG AGARWAL * * INSTITUITION: BITS PILANI, PILANI * ******************************************/ #include using namespace std; typedef long long LL; typedef long double LD; const int MAX=1e5+5; const int MOD=1e9+7; LL fac[MAX]; LL ifac[MAX]; int cnt[26][MAX]; int tmp[26]; typedef long long LL; int add(int a, int b, int c) { int res = a + b; return (res >= c ? res - c : res); } int mod_neg(int a, int b, int c) { int res; if(abs(a-b) < c) res = a - b; else res = (a-b) % c; return (res < 0 ? res + c : res); } int mul(int a, int b, int c) { LL res = (LL)a * b; return (res >= c ? res % c : res); } template T power(T e, T n, T m) { T x = 1, p = e; while(n) { if(n & 1) x = mul(x, p, m); p = mul(p, p, m); n >>= 1; } return x; } template T extended_euclid(T a, T b, T &x, T &y) { T xx = 0, yy = 1; y = 0; x = 1; while(b) { T q = a / b, t = b; b = a % b; a = t; t = xx; xx = x - q * xx; x = t; t = yy; yy = y - q * yy; y = t; } return a; } template T mod_inverse(T a, T n) { T x, y, z = 0; T d = extended_euclid(a, n, x, y); return (d > 1 ? -1 : mod_neg(x, z, n)); } int main() { fac[0]=1; ifac[0]=1; for(int i=1;i>s; for(int i=0;i