import re p=re.compile(r'\(|\)|,') M=10**9+7;U=2000001;F=[1];FI=[0]*U for i in xrange(1,U):F+=[(i*F[i-1])%M] FI[U-1]=pow(F[U-1],M-2,M) for i in xrange(U-1,0,-1):FI[i-1]=i*FI[i]%M for i in xrange(input()): q=p.split(raw_input());N,K=map(int,q[1:3]) if q[0]=="C":A=[(F[N]*FI[K]*FI[N-K])%M,0][N