#include #define MOD 1000000007 #define Loop(i,a,b) for(int i=a;i=b;--i) using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin>>s; int t; cin>>t; while(t--) { int a,b; cin>>a>>b; map mp; string s2 = s.substr(a-1,b); for(int i=0;i0) { ans = 1; for(int i=2;i<=no2;++i) ans = (ans%MOD * i%MOD)%MOD; if(no1>0) ans = (ans%MOD * no1%MOD)%MOD; cout<