#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2500000000;
const int inf = 123456789;
const double EPS = 1e-9;
const double PI = 2 * asin(1.0);
const long long mod = 1e9 + 7;
int double_cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
const int N = 3e5;
int n;
int t[2 * N][2];
void modify(int p, int value, int q) {
  for (t[p += n][q] += value; p > 1; p >>= 1)
    t[p >> 1][q] = t[p][q] + t[p ^ 1][q];
}
int query(int l, int r, int q) {
  int res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) res += t[l++][q];
    if (r & 1) res += t[--r][q];
  }
  return res;
}
int main() {
  scanf("%d", &n);
  int k;
  scanf("%d", &k);
  int a, b;
  scanf("%d%d", &a, &b);
  int q;
  scanf("%d", &q);
  a -= b;
  for (int i = 0; i < q; ++i) {
    int s;
    scanf("%d", &s);
    if (s == 1) {
      int x, y;
      scanf("%d%d", &x, &y);
      int aux = min(b - t[x + n][0], y);
      int aux2 = max(0, min(a - t[x + n][1], y - aux));
      modify(x, aux, 0);
      modify(x, aux2, 1);
    } else {
      int x;
      scanf("%d", &x);
      long long saida =
          query(1, x, 0) + query(x + k, n + 1, 1) + query(x + k, n + 1, 0);
      cout << saida << endl;
    }
  }
}
