#include using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define fi first #define se second const ll mod=1e9+7; ll mod_inv(ll x) { ll pw[32]; pw[0]=x; for(int i=1; i<32; ++i) pw[i]=(pw[i-1]*pw[i-1])%mod; ll ret=1; ll p=mod-2; rep(i,32) if(p>>i&1) (ret*=pw[i])%=mod; return ret; } ll fact[2000000]={0}; int main() { fact[0]=1; for(ll i=1; i<2000000; ++i) fact[i]=(fact[i-1]*i)%mod; int TIMES; cin >>TIMES; rep(T,TIMES) { string s; cin >>s; ll a,b; for(int i=2; i