#include using namespace std; #define LL long long LL M = (LL)(1e9+7); string str; int st[3*100009][26]; int alpha[26]; LL fact[100009]; void build(int s,int e,int idx){ if(s>e){return ;} if(s==e){ st[idx][str[s]-'a']++; //cout<e || s>r || l>e){return ;} if(l<=s && r>=e){ for(int i=0;i<26;i++){ alpha[i]+=st[idx][i]; } return ; } int m=(s+e)/2; query(s,m,l,r,2*idx+1); query(m+1,e,l,r,2*idx+2); } LL modinv(LL a,LL m){ LL m0 = m, t, q; LL x0 = 0, x1 = 1; if (m == 1) return 0; while (a > 1) { // q is quotient q = a / m; t = m; // m is remainder now, process same as // Euclid's algo m = a % m, a = t; t = x0; x0 = x1 - q * x0; x1 = t; } // Make x1 positive if (x1 < 0) x1 += m0; return x1; } int main(){ fact[0]=1; for(int i=1;i<100009;i++){ fact[i] = (fact[i-1]*i)%M; } cin>>str; int n = (int)str.length(); // cout<>q; while(q--){ int l,r; cin>>l>>r; memset(alpha,0,sizeof(alpha)); query(0,n-1,l-1,r-1,0); LL ans=1; int x=0; LL y=0; for(int i=0;i<26;i++){ x += (alpha[i] - alpha[i]%2); y = y + (LL)(alpha[i]%2); } //cout<0){ans = (ans*y)%M;} cout<