#include <bits/stdc++.h>
using namespace std;
const long long rt = 1e7 + 19;
const long long mod = 1e9 + 7;
const int inf = 2e9;
const int mxn = 4e4, mxk = 1e4;
int n, k, qry;
vector<int> obj[mxn * 4];
int sack[22][mxk], v[mxn], w[mxn], go[mxn], com[mxn];
bool respos[mxn];
void add(int l, int r, int ql, int qr, int cur, int object) {
  if (ql <= l and r <= qr) {
    obj[cur].push_back(object);
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) {
    add(l, mid, ql, qr, cur + cur, object);
  }
  if (mid < qr) {
    add(mid + 1, r, ql, qr, cur + cur + 1, object);
  }
}
void dfs(int l, int r, int cur, int level) {
  for (int i = 0; i <= k; i++) {
    sack[level][i] = sack[level - 1][i];
  }
  for (auto u : obj[cur]) {
    for (int i = k; i >= 0; i--) {
      if (i + w[u] > k or sack[level][i] == -inf) continue;
      sack[level][i + w[u]] = max(sack[level][i + w[u]], sack[level][i] + v[u]);
    }
  }
  if (l == r) {
    if (respos[l] == false) return;
    long long res = 0, mx = 0, p = 1;
    for (int m = 1; m <= k; m++) {
      mx = max(mx, 1LL * sack[level][m]);
      res = (p * mx + res) % mod;
      p = (p * rt) % mod;
    }
    printf("%lld\n", res);
    return;
  }
  int mid = (l + r) >> 1;
  dfs(l, mid, cur + cur, level + 1);
  dfs(mid + 1, r, cur + cur + 1, level + 1);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", v + i, w + i);
    com[i] = 1;
  }
  scanf("%d", &qry);
  for (int i = 1; i <= qry; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      n++;
      scanf("%d%d", v + n, w + n);
      com[n] = i;
    } else if (type == 2) {
      int q;
      scanf("%d", &q);
      go[q] = i;
    } else {
      respos[i] = true;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (go[i] == 0) go[i] = qry;
    add(1, qry, com[i], go[i], 1, i);
  }
  fill(sack[0] + 1, sack[0] + 1111, -inf);
  dfs(1, qry, 1, 1);
  return 0;
}
