#include #include #include #include #include #define P 1000000007 using namespace std; unsigned long long int calculate(string s) { int n=s.length(); int i,j,cl,L[n][n]; for (i = 0; i < n; i++) L[i][i] = 1; for (cl=2; cl<=n; cl++) { for (i=0; i>s; int t; cin>>t; while(t--) { int l,r; cin>>l>>r; string temp=s.substr(l,r-l); unsigned long long int result=calculate(temp); cout<