#include #define LL long long #define M 1000000007 #define PB push_back using namespace std; int inv(int a,int m) { int m0 = m, t, q; int x0 = 0, x1 = 1; if (m == 1) return 0; while (a > 1) { q = a / m; t = m; m = a % m, a = t; t = x0; x0 = x1 - q * x0; x1 = t; } if (x1 < 0) x1 += m0; return x1; } int main() { string s; cin >> s; LL an[30],fact[100010],l,r,i,n,ans,lol,k,factinv[100010]; vector ct[30]; //initialize(s); int q; for(i=0;i> q; for(int a0 = 0; a0 < q; a0++){ cin>>l>>r; l--;r--; k=0; //cout<