#include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 template T pow(T x, int power, T mod) { T res = 1; for(T b=x; power; power>>=1) { if(power&1) res = (res * b) % mod; b = (b * b) % mod; } return res; } ll inv(ll x) { ll y = pow(x, MOD-2, (ll)MOD); //ASSERT(x*y%MOD == 1); return y; } int s[32][100111] ={0}; int fact[100111]; int ifact[100111]; int main() { string str; cin >> str; int n = str.size(); for(int l=0; l<26; ++l) for(int i=0; i> q; for(int i=0; i> l >> r; int sl[26] = {0}; int tot = 0, nodd = 0; for(int j=0; j<26; ++j) { sl[j] = s[j][r] - s[j][l-1]; if(sl[j]%2) nodd += 1; sl[j] /= 2; //sl[j] *= 2; tot += sl[j]; } ll ans = max(1,nodd); ans = (ans*fact[tot])%MOD; for(int j=0; j<26; ++j) ans = (ans*ifact[sl[j]])%MOD; cout << ans << "\n"; } return 0; }