#include #include #include #include #define maxn 100010 #define LL __int64 #define mod 1000000007 using namespace std; LL get(LL x,LL M) { LL ans=1; while(M) { if(M%2) ans=(ans*x)%mod; M/=2; x=(x*x)%mod; } return ans; } LL solve(LL x) { LL ans=1; for(int i=1;i<=x;i++) ans=(ans*i)%mod; return ans; } char s[1010]; int main() { int T; scanf("%d",&T); while(T--) { scanf("%s",s); LL c[30]; memset(c,0,sizeof(c)); LL len=strlen(s); if(len==1) { puts("1"); continue; } for(LL i=0;i1) { puts("0"); continue; } LL ans=0; ans=solve(len/2); for(int i=0;i<30;i++) { if(!c[i]) continue; ans=(ans*get(solve(c[i]/2),mod-2))%mod; } printf("%I64d\n",ans); } return 0; }