func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 30, Mod = 1e9 + 7;   const long long SQ = 330;   const long long INF = 1e17;   long long a[N], n, q;   long long sum[N << 2], mx[N << 2];   void Change(int x, int val, int id = 1, int b = 0, int e = n) {     if (e - b == 1) {       mx[id] = a[x] = val;       sum[id] = val;       return;     }     if (x < ((b + e) >> 1))       Change(x, val, id << 1, b, ((b + e) >> 1));     else       Change(x, val, id << 1 | 1, ((b + e) >> 1), e);     sum[id] = sum[id << 1] + sum[id << 1 | 1];     mx[id] = max(mx[id << 1], mx[id << 1 | 1]);   }   long long Get(int l, int r, int id = 1, int b = 0, int e = n) {     if (r <= b || e <= l) return 0;     if (l <= b && e <= r) return sum[id];     return Get(l, r, id << 1, b, ((b + e) >> 1)) +            Get(l, r, id << 1 | 1, ((b + e) >> 1), e);   }   void Set(int l, int r, int m, int id = 1, int b = 0, int e = n) {     if (mx[id] < m) return;     if (r <= b || e <= l) return;     if (e - b == 1) {       sum[id] = mx[id] = mx[id] % m;       return;     }     Set(l, r, m, id << 1, b, ((b + e) >> 1));     Set(l, r, m, id << 1 | 1, ((b + e) >> 1), e);     sum[id] = sum[id << 1] + sum[id << 1 | 1];     mx[id] = max(mx[id << 1], mx[id << 1 | 1]);   }   int main() {     ios::sync_with_stdio(0), cin.tie(0);     cin >> n >> q;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) Change(i, a[i]);     while (q--) {       long long t;       cin >> t;       switch (t) {         case 1:           int l, r;           cin >> l >> r;           l--;           cout << Get(l, r) <<   n ;           break;         case 2:           int x;           cin >> l >> r >> x;           l--;           Set(l, r, x);           break;         case 3:           int k;           cin >> k >> x;           Change(k - 1, x);       }     }     return (0);   }   