func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 2e5 + 9;   int seg[MAX * 4][2], n, k, a, b, q, ar[MAX];   void upd(int x, int s = 0, int e = n, int id = 0) {     if (e - s == 1) {       seg[id][0] = min(ar[s], a), seg[id][1] = min(ar[s], b);       return;     }     int mid = s + e >> 1;     if (x < mid)       upd(x, s, mid, id * 2 + 1);     else       upd(x, mid, e, id * 2 + 2);     seg[id][0] = seg[id * 2 + 1][0] + seg[id * 2 + 2][0];     seg[id][1] = seg[id * 2 + 1][1] + seg[id * 2 + 2][1];   }   pair<int, int> gt(int l, int r, int s = 0, int e = n, int id = 0) {     pair<int, int> ret = {0, 0};     if (r <= s || e <= l) return ret;     if (l <= s && e <= r) return {seg[id][0], seg[id][1]};     int mid = s + e >> 1;     pair<int, int> le = gt(l, r, s, mid, id * 2 + 1),                    ri = gt(l, r, mid, e, id * 2 + 2);     ret = {le.first + ri.first, le.second + ri.second};     return ret;   }   int main() {     cin >> n >> k >> a >> b >> q, n++;     while (q--) {       int t, d, a;       cin >> t >> d;       if (t == 1)         cin >> a, ar[d] += a, upd(d);       else         cout << gt(0, d).second + gt(d + k, n).first <<   n ;     }   }   