#include #include #include #include #include #include #include #include #include #include using namespace std; #define inf 1000000007 #define MOD 1000000007 #define x first #define y second #define ll long long #define ii pair #define vi vector #define vii vector #define pb push_back #include #define mp make_pair #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;} inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;} inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;} inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);} ll n, k, flag=0; ll A[100005][27]; ll fact[100005]; ll infact[100005]; int main() { ios ll a, b, c=0, i, j; ll ans=0; ll t, n; fact[0]= 1; for(i=1; i<=100001; i++) fact[i]= (fact[i-1]*i)%inf; infact[100000]= inv(fact[100000]); for(i=99999; i>=0; i--) infact[i]= (infact[i+1]*(i+1))%inf; string s; cin>>s; s= ' '+s; n= s.length(); for(i=1; i>k; while(k--){ ans= 0; ll flag= 0, l, r; cin>>l>>r; vi v(27, 0); for(i=0; i<26; i++){ v[i]= A[r][i] - A[l-1][i]; if(v[i]&1) flag++; ans+= v[i]/2; } ans= fact[ans]; for(i=0; i<26; i++){ ans= (ans*infact[v[i]/2])%inf; } if(flag) ans= (ans*flag)%inf; cout<