#include using namespace std; #define ll long long #define N 100005 #define mod 1000000007 #define boost ios_base::sync_with_stdio(false);cin.tie(0) #define prec(n) fixed< #define pll pair #define fi first #define se second #define pb push_back #define vi vector #define vll vector ll modulo(ll num){ return ((num%mod)+mod)%mod;} // for negative integer ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;} ll invf[N],f[2*N]; ll inv(ll num) { return power(num,mod-2); } void pre() { invf[1]=inv(1); for(ll i=2;i>s; s=" "+s; for(i=0;i<26;i++) ps[0][i]=0; for(i=1;s[i];i++) { for(j=0;j<26;j++) { if( (s[i]-'a') == j) ps[i][j]=ps[i-1][j]+1; else ps[i][j]=ps[i-1][j]; } } cin>>q; while(q--) { cin>>l>>r; vll den ; ll cnt=0; num=0; den.pb(1); for(j=0;j<26;j++) { ll temp = (ps[r][j] - ps[l-1][j])/2; num+=temp; if(temp>1) den.pb(temp); cnt+=( (ps[r][j] - ps[l-1][j])%2 ) ; } if(cnt==0) cnt=1; ans=f[num]; for(i=0;i