#include <bits/stdc++.h>
using namespace std;
struct FenwickTree {
  vector<int> bit;
  int n;
  FenwickTree(int n) {
    this->n = n;
    bit.assign(n, 0);
  }
  int sum(int r) {
    int sum = 0;
    while (r >= 0) {
      sum += bit[r];
      r = (r & (r + 1)) - 1;
    }
    return sum;
  }
  int sum(int l, int r) { return sum(r) - sum(l - 1); }
  void add(int index, int val) {
    while (index < n) {
      bit[index] += val;
      index = index | (index + 1);
    }
  }
  int getNum(int index) { return sum(index, index); }
};
int main() {
  int n, k, a, b, q;
  cin >> n >> k >> a >> b >> q;
  FenwickTree antes = FenwickTree(n + 1);
  FenwickTree depois = FenwickTree(n + 1);
  while (q--) {
    int type, d, val;
    cin >> type >> d;
    if (type == 1) {
      cin >> val;
      int aux1 = min(b - antes.getNum(d), val);
      int aux2 = min(a - depois.getNum(d), val);
      antes.add(d, aux1);
      depois.add(d, aux2);
    } else {
      int resp = 0;
      resp += antes.sum(d - 1);
      resp += depois.sum(d + k, n);
      cout << resp << endl;
    }
  }
  return 0;
}
