#include using namespace std; #define ll long long int #define M 1000000007 vector > pre; vector fac(1000009,0); void initialize(string s) { vector tmp(30,0); pre.push_back(tmp); for(int i=0;i0) { if(expo&1)result = (result*base)%M; base = (base*base)%M; expo = expo>>1; } return result; } ll fact(ll n) { ll result = 1; for(ll i=1;i<=n;i++)result = (result*i)%M; return result; } int answerQuery(int l, int r,string s) { vector ct(30,0); //for(int i=l-1;i tmp; tmp.clear(); for(int i=0;i<30;i++) { if(ct[i]==1)ct1++; else if(ct[i]>1) { isPossible = true; if(ct[i]%2==1)ct1++; tmp.push_back(ct[i]/2); sum+=(ct[i]/2); } } //cout << "sum = " << sum << endl; ll num = fac[sum],denom = 1; for(int i=0;i