func_code_string: #include <bits/stdc++.h>   using namespace std;   const int modn = (int)1e9 + 7, N = (int)1e5 + 10;   int a[N], p[N][6], q[N], c[6][6][6], n, m;   inline void add(int &x, int y) {     x += y;     if (x >= modn) x %= modn;   }   struct zz {     int power, x, s, t, tot;     int v[N << 2], ls[N << 2], rs[N << 2], b[N << 2];     void build(int l, int r, int now) {       b[now] = -1;       if (l == r) {         v[now] = (long long)a[l] * p[l][power] % modn;         return;       }       int mid = (l + r) >> 1;       ls[now] = ++tot;       rs[now] = ++tot;       build(l, mid, ls[now]);       build(mid + 1, r, rs[now]);       add(v[now], v[ls[now]]);       add(v[now], v[rs[now]]);     }     void push(int l, int r, int now) {       if (b[now] != -1 && l != r) {         int mid = (l + r) >> 1;         v[ls[now]] =             (long long)b[now] * (p[mid][power] - p[l - 1][power] + modn) % modn;         v[rs[now]] =             (long long)b[now] * (p[r][power] - p[mid][power] + modn) % modn;         b[rs[now]] = b[ls[now]] = b[now];         b[now] = -1;       }     }     void make(int l, int r, int now) {       if (l >= s && r <= t) {         b[now] = x;         v[now] = (long long)x * (p[r][power] - p[l - 1][power] + modn) % modn;         return;       }       push(l, r, now);       int mid = (l + r) >> 1;       if (mid >= s) make(l, mid, ls[now]);       if (mid < t) make(mid + 1, r, rs[now]);       v[now] = 0;       add(v[now], v[ls[now]]);       add(v[now], v[rs[now]]);     }     int ask(int l, int r, int now) {       if (l >= s && r <= t) return v[now];       push(l, r, now);       int mid = (l + r) >> 1, ret = 0;       if (mid >= s) add(ret, ask(l, mid, ls[now]));       if (mid < t) add(ret, ask(mid + 1, r, rs[now]));       v[now] = 0;       add(v[now], v[ls[now]]);       add(v[now], v[rs[now]]);       return ret;     }   } T[6];   inline void read(int &ret) {     ret = 0;     char x = getchar();     while (x <  0  || x >  9 ) x = getchar();     while (x >=  0  && x <=  9 ) {       ret = ret * 10 + x -  0 ;       x = getchar();     }   }   inline int spj() {     static int l, r, k, ch[6], pp[6];     int ret = 0;     read(l);     read(r);     read(k);     pp[0] = 1;     for (int i = 0; i <= k; ++i) {       if (i != 0) pp[i] = (long long)pp[i - 1] * (modn - l) % modn;       T[i].s = l;       T[i].t = r;       ch[i] = T[i].ask(1, n, 0);     }     for (int i = 0; i <= k; ++i)       for (int j = 0; i + j <= k; ++j)         add(ret, (long long)ch[i] * c[i][j][k - i - j] % modn * pp[j] % modn);     return ret;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) read(a[i]);     for (int i = 1; i <= n; ++i) {       p[i][0] = 1;       for (int j = 1; j < 6; ++j) p[i][j] = (long long)p[i][j - 1] * i % modn;     }     for (int i = 0; i < 6; ++i) T[i].power = i;     for (int i = 0; i < 6; ++i) T[i].build(1, n, 0);     for (int i = 1; i <= n; ++i)       for (int j = 0; j < 6; ++j) add(p[i][j], p[i - 1][j]);     q[0] = 1;     for (int i = 1; i < 6; ++i) q[i] = q[i - 1] * i;     for (int i = 0; i < 6; ++i)       for (int j = 0; j < 6; ++j)         for (int k = 0; k < 6; ++k)           if (i + j + k < 6) c[i][j][k] = q[i + j + k] / q[i] / q[j] / q[k];     for (int i = 1; i <= m; ++i) {       int l, r, x;       char cc = getchar();       while (cc !=  ?  && cc !=  = ) cc = getchar();       if (cc ==  = ) {         read(l);         read(r);         read(x);         for (int i = 0; i < 6; ++i) {           T[i].s = l;           T[i].t = r;           T[i].x = x;           T[i].make(1, n, 0);         }       } else         printf( %d n , spj());     }   }   