#include <bits/stdc++.h>   using namespace std;   int n, k, a, b, q;   int Size;   int getMid(int s, int e) { return s + (e - s) / 2; }   int getSumUtil(int *st, int ss, int se, int qs, int qe, int si) {     if (qs <= ss && qe >= se) return st[si];     if (se < qs || ss > qe) return 0;     int mid = getMid(ss, se);     return getSumUtil(st, ss, mid, qs, qe, 2 * si + 1) +            getSumUtil(st, mid + 1, se, qs, qe, 2 * si + 2);   }   void updateValueUtilhigh_prod(int *st, int ss, int se, int i, int diff,                                 int si) {     if (i < ss || i > se) return;     if (ss == se) {       st[si] = min(st[si] + diff, a);       return;     }     int mid = getMid(ss, se);     updateValueUtilhigh_prod(st, ss, mid, i, diff, 2 * si + 1);     updateValueUtilhigh_prod(st, mid + 1, se, i, diff, 2 * si + 2);     st[si] = st[2 * si + 1] + st[2 * si + 2];   }   void updateValueUtillow_prod(int *st, int ss, int se, int i, int diff, int si) {     if (i < ss || i > se) return;     if (ss == se) {       st[si] = min(st[si] + diff, b);       return;     }     int mid = getMid(ss, se);     updateValueUtillow_prod(st, ss, mid, i, diff, 2 * si + 1);     updateValueUtillow_prod(st, mid + 1, se, i, diff, 2 * si + 2);     st[si] = st[2 * si + 1] + st[2 * si + 2];   }   void updateValue(int arr[], int *st, int n, int i, int new_val, int flag) {     if (i < 0 || i > n - 1) {       return;     }     if (flag == 1)       updateValueUtillow_prod(st, 0, n - 1, i, new_val, 0);     else       updateValueUtilhigh_prod(st, 0, n - 1, i, new_val, 0);   }   int getSum(int *st, int n, int qs, int qe) {     if (qs < 0 || qe > n - 1 || qs > qe) {       return 0;     }     return getSumUtil(st, 0, n - 1, qs, qe, 0);   }   int constructSTUtil(int arr[], int ss, int se, int *st, int si) {     if (ss == se) {       st[si] = arr[ss];       return arr[ss];     }     int mid = getMid(ss, se);     st[si] = constructSTUtil(arr, ss, mid, st, si * 2 + 1) +              constructSTUtil(arr, mid + 1, se, st, si * 2 + 2);     return st[si];   }   int *constructST(int arr[], int n) {     int x = (int)(ceil(log2(n)));     int max_size = 2 * (int)pow(2, x) - 1;     Size = max_size;     int *st = new int[max_size];     constructSTUtil(arr, 0, n - 1, st, 0);     return st;   }   int main() {     cin >> n >> k >> a >> b >> q;     int arr[n];     memset(arr, 0, sizeof(arr));     int *low_prod = constructST(arr, n);     int *high_prod = constructST(arr, n);     for (int i = 0; i < Size; i++) {       low_prod[i] = 0;       high_prod[i] = 0;     }     while (q--) {       int ch;       cin >> ch;       if (ch == 1) {         int pos, data;         cin >> pos >> data;         updateValue(arr, low_prod, n, pos - 1, data, 1);         updateValue(arr, high_prod, n, pos - 1, data, 2);       } else {         int pos, pos2;         cin >> pos;         pos--;         if (pos == 0 || pos + k - 1 == n - 1) {           if (pos == 0) {             int ans = getSum(high_prod, n, k, n - 1);             cout << ans << endl;           } else {             int ans = getSum(low_prod, n, 0, pos - 1);             cout << ans << endl;           }         } else           cout << getSum(low_prod, n, 0, pos - 1) +                       getSum(high_prod, n, pos + k, n - 1)                << endl;       }     }     return 0;   }