func_code_string: #include <bits/stdc++.h>   using namespace std;   namespace input {   const int InputBufferSize = (1 << 24) + 5;   char buffer[InputBufferSize], *s, *eof;   inline void init() {     assert(stdin != NULL);     s = buffer;     eof = s + fread(buffer, 1, InputBufferSize, stdin);   }   inline bool read(int& x) {     x = 0;     int flag = 1;     while (!isdigit(*s) && *s !=  - ) s++;     if (eof <= s) return false;     if (*s ==  - ) flag = -1, s++;     while (isdigit(*s)) x = x * 10 + *s++ -  0 ;     x *= flag;     return true;   }   inline bool read(char* str) {     *str = 0;     while (isspace(*s)) s++;     if (eof < s) return false;     while (!isspace(*s)) *str = 0, *str = *s, str++, s++;     *str = 0;     return true;   }   }  // namespace input   using namespace input;   int const p = 1e9 + 7;   int pr[305], cnt, a[400005], tmp[65], id[305], c[305], tree[1600005],       tag[1600005];   long long b[400005], tree2[1600005], tag2[1600005];   bool flag[305];   long long res(int x) {     memset(tmp, 0, sizeof(tmp));     long long res = 0;     for (int i = 0; i <= 6; i++)       while (!(x % pr[i])) x /= pr[i], res |= (1ll << i);     if (x != 1) res |= (1ll << id[x]);     return res;   }   int pw(int x, int y) {     int res = 1;     while (y) {       if (y & 1) res = 1ll * res * x % p;       x = 1ll * x * x % p;       y >>= 1;     }     return res;   }   void build(int l, int r, int x) {     if (l == r) {       tree[x] = a[l];       tag[x] = 1;       return;     }     int mid = (l + r) >> 1;     build(l, mid, x * 2), build(mid + 1, r, x * 2 + 1);     tree[x] = 1ll * tree[x * 2] * tree[x * 2 + 1] % p;     tag[x] = 1;   }   void build2(int l, int r, int x) {     if (l == r) {       tree2[x] = b[l];       return;     }     int mid = (l + r) >> 1;     build2(l, mid, x * 2), build2(mid + 1, r, x * 2 + 1);     tree2[x] = (tree2[x * 2] | tree2[x * 2 + 1]);   }   void pushdown(int l, int r, int x) {     if (tag[x] == 1) return;     tree[x] = 1ll * tree[x] * pw(tag[x], r - l + 1) % p;     if (l != r)       tag[x * 2] = 1ll * tag[x * 2] * tag[x] % p,               tag[x * 2 + 1] = 1ll * tag[x * 2 + 1] * tag[x] % p;     tag[x] = 1;   }   void modify(int l, int r, int x, int a, int b, int c) {     if (l >= a && r <= b) {       tag[x] = 1ll * tag[x] * c % p;       return;     }     int mid = (l + r) >> 1;     if (a <= mid) modify(l, mid, x * 2, a, b, c);     if (b > mid) modify(mid + 1, r, x * 2 + 1, a, b, c);     pushdown(l, mid, x * 2), pushdown(mid + 1, r, x * 2 + 1);     tree[x] = 1ll * tree[x * 2] * tree[x * 2 + 1] % p;   }   void pushdown2(int l, int r, int x) {     if (!tag2[x]) return;     tree2[x] |= tag2[x];     if (l != r) tag2[x * 2] |= tag2[x], tag2[x * 2 + 1] |= tag2[x];     tag2[x] = 0;   }   void modify2(int l, int r, int x, int a, int b, long long c) {     if (l >= a && r <= b) {       tag2[x] = (tag2[x] | c);       return;     }     int mid = (l + r) >> 1;     if (a <= mid) modify2(l, mid, x * 2, a, b, c);     if (b > mid) modify2(mid + 1, r, x * 2 + 1, a, b, c);     pushdown2(l, mid, x * 2), pushdown2(mid + 1, r, x * 2 + 1);     tree2[x] = (tree2[x * 2] | tree2[x * 2 + 1]);   }   int ask(int l, int r, int x, int a, int b) {     pushdown(l, r, x);     if (l >= a && r <= b) return tree[x];     int mid = (l + r) >> 1, res = 1;     if (a <= mid) res = ask(l, mid, x * 2, a, b);     if (b > mid) res = 1ll * res * ask(mid + 1, r, x * 2 + 1, a, b) % p;     return res;   }   long long ask2(int l, int r, int x, int a, int b) {     pushdown2(l, r, x);     if (l >= a && r <= b) return tree2[x];     int mid = (l + r) >> 1;     long long res = 0;     if (a <= mid) res = ask2(l, mid, x * 2, a, b);     if (b > mid) res = (res | ask2(mid + 1, r, x * 2 + 1, a, b));     return res;   }   char op[15];   int main() {     for (int i = 2; i <= 300; i++) {       if (!flag[i])         pr[cnt] = i, id[i] = cnt, c[cnt] = 1ll * (i - 1) * pw(i, p - 2) % p,         cnt++;       for (int j = i * 2; j <= 300; j += i) flag[j] = 1;     }     init();     int n, q, l, r, x;     long long y;     read(n), read(q);     for (int i = 1; i <= n; i++) {       read(a[i]);       b[i] = res(a[i]);     }     build(1, n, 1), build2(1, n, 1);     while (q--) {       read(op);       if (op[0] ==  M ) {         read(l), read(r), read(x);         y = res(x);         modify(1, n, 1, l, r, x), modify2(1, n, 1, l, r, y);       } else {         read(l), read(r);         x = ask(1, n, 1, l, r), y = ask2(1, n, 1, l, r);         for (int j = 0; j <= 61; j++)           if (y & (1ll << j)) x = 1ll * x * c[j] % p;         printf( %d n , x);       }     }     return 0;   }   