#include using namespace std; #include using namespace atcoder; using ll = long long; int t; string s; using mint = modint1000000007; mint fac[5050505],facinv[5050505]; void solve(){ int l = 0,r = 0; auto t = s; s.pop_back(); s.erase(s.begin()); s.erase(s.begin()); bool is = false; for(int i = 0;i=0) ans = fac[l]*facinv[l-r]; else ans = 0; }else{ if(l-1>=0) ans = fac[l+r-1]*facinv[r]*facinv[l+r-1-r]; else ans =0 ; } cout<> t; while(t--){ cin >> s; solve(); } }