#include #include #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long ll; const ll mod=1e9+7; const int N=1<<21; ll fact[N]; ll invmod(ll v, ll m) { ll sum=1, cur=v%m; ll e=m-2; for(;e;e/=2) { if(e%2)sum=sum*cur%m; cur=cur*cur%m; } return sum; } ll comb(ll n, ll k) { if (n>t; fact[0]=1; REP(i,1,N)fact[i]=fact[i-1]*i%mod; REP(l,0,t) { string s; cin>>s; stringstream ss; ss<>n; ss.ignore(); ss>>k; switch(c) { case'C': cout<=k?fact[n]*invmod(fact[n-k],mod)%mod:0)<