#include <bits/stdc++.h>
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
const int N = 5000, Q = 30000, QQ = 32768, BASE = 1e7 + 19, MOD = 1e9 + 7;
int k, v[N + Q], w[N + Q], s[N + Q], e[N + Q];
int op[Q], ans[QQ];
vector<int> seg[QQ * 2];
void add(int l, int r, int x) {
  for (l += QQ, r += QQ; l < r; l >>= 1, r >>= 1) {
    if (l & 1) seg[l++].push_back(x);
    if (r & 1) seg[--r].push_back(x);
  }
}
void topdown(int rt, vector<int> dp) {
  if (rt >= QQ * 2) return;
  for (int i : seg[rt])
    for (int j = (k + 1); --j >= (w[i]);)
      dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
  if (rt < QQ) {
    topdown(rt * 2, dp);
    topdown(rt * 2 + 1, dp);
  } else {
    int d = 0;
    long long p = 1;
    for (int i = 1; i <= (k); i++) {
      d = max(d, dp[i]);
      ans[rt - QQ] = (ans[rt - QQ] + p * d) % MOD;
      p = (p * BASE) % MOD;
    }
  }
}
int main() {
  int n = ri();
  k = ri();
  for (int i = 0; i < (n); i++) {
    v[i] = ri();
    w[i] = ri();
  }
  int q = ri(), tick = 0;
  fill_n(e, n + q, -1);
  for (int i = 0; i < (q); i++) {
    int op = ri();
    if (op == 1) {
      v[n] = ri();
      w[n] = ri();
      s[n++] = tick;
    } else if (op == 2)
      e[ri() - 1] = tick;
    else
      tick++;
  }
  for (int i = 0; i < (n); i++) add(s[i], ~e[i] ? e[i] : tick, i);
  topdown(1, vector<int>(k + 1));
  for (int i = 0; i < (tick); i++) printf("%d\n", ans[i]);
}
