//==================================== //====================================== // // Bismillahir-Rahmanir-Rahim // // ========================================================================== #include #define ll long long int #define FOR(x,y,z) for(int x=y;x #define pll pair #define CLR(a) memset(a,0,sizeof(a)) #define SET(a) memset(a,-1,sizeof(a)) #define N 200010 #define M 1000000007 #define pi acos(-1.0) #define ff first #define ss second #define pb push_back #define inf (1e9)+1000 #define eps 1e-9 #define ALL(x) x.begin(),x.end() using namespace std; int dx[]={0,0,1,-1,-1,-1,1,1}; int dy[]={1,-1,0,0,-1,1,1,-1}; template < class T> inline T biton(T n,T pos){return n |((T)1< inline T bitoff(T n,T pos){return n & ~((T)1< inline T ison(T n,T pos){return (bool)(n & ((T)1< inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;} template string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); } inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;} inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;} inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;} template inline T bigmod(T p,T e,T m){T ret = 1; for(; e > 0; e >>= 1){ if(e & 1) ret = (ret * p) % m;p = (p * p) % m; } return (T)ret;} #ifdef sayed #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) template < typename Arg1 > void __f(const char* name, Arg1&& arg1){ cerr << name << " is " << arg1 << std::endl; } template < typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names+1, ','); cerr.write(names, comma - names) << " is " << arg1 <=0; i--) finv[i] = (finv[i+1] * (i+1)) % M; } ll ncr(int n, int k){ return (((fac[n] * finv[k]) % M) * finv[n-k]) % M; } int main(){ #ifdef sayed //freopen("out.txt","w",stdout); // freopen("in.txt","r",stdin); #endif //ios_base::sync_with_stdio(false); //cin.tie(0); gen(); string s; cin>>s; s='?' + s; for(int i = 1;i>n; for(int i = 0;i>l>>r; int letter[26]={0}; ll odd = 0; int sum = 0; for(int j = 0;j<26;j++) { letter[j]=ar[j][r]-ar[j][l-1]; if(letter[j]%2==1) odd++; sum+=letter[j]/2; } ll ans= fac[sum]; for(int j = 0;j<26;j++) { ans*=finv[letter[j]/2]; ans%=M; } if(odd) ans*=odd; ans%=M; printf("%lld\n",ans); } return 0; }