#include using namespace std; #define ll long long #define maxn 100000 #define mo 1000000007 string s; int l,r,q,a[28][maxn],giaithua[maxn]; void pre() { a[s[0]-'a'][0]=1; for (int i=1;i>s; pre(); cin>>q; for (int t=0;t>l>>r; l--;r--; int pari=0,unpari=0,res=0; for (int i=0;i<26;i++) pari+=(a[i][r]-a[i][l-1])/2,unpari+=(a[i][r]-a[i][l-1])%2; if (pari==0) cout<<0; else { res=max(1,giaithua[unpari]); res=(res*giaithua[pari])%mo; cout<