#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int p = 1e7 + 19;
const int mod = 1e9 + 7;
int n, a[N], st[N], en[N], q, k, timer, m, v[N], w[N], ans[N];
vector<int> T[N];
void upd(int x, int l, int r, int v = 1, int tl = 1, int tr = timer) {
  if (tl > r || tr < l || tl > tr || l > r) return;
  if (l <= tl && tr <= r) {
    T[v].push_back(x);
    return;
  }
  int tm = (tl + tr) / 2;
  upd(x, l, r, v * 2, tl, tm), upd(x, l, r, v * 2 + 1, tm + 1, tr);
}
void insert(vector<int> &dp, int x) {
  vector<int> ans = dp;
  for (int i = w[x]; i <= k; i++) ans[i] = max(dp[i - w[x]] + v[x], ans[i]);
  dp = ans;
}
void go(int v = 1, int tl = 1, int tr = timer,
        vector<int> dp = vector<int>(k + 1)) {
  for (auto it : T[v]) insert(dp, it);
  if (tl == tr) {
    ans[tl] = 0;
    int pw = 1;
    int d = 0;
    for (int i = 1; i <= k; i++) {
      d = max(d, dp[i]);
      ans[tl] = (ans[tl] + (1ll * d * pw) % mod) % mod;
      pw = (1ll * pw * p) % mod;
    }
    return;
  }
  int tm = (tl + tr) / 2;
  go(v * 2, tl, tm, dp), go(v * 2 + 1, tm + 1, tr, dp);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    ++m;
    scanf("%d%d", &v[m], &w[m]);
  }
  scanf("%d", &q);
  memset(st, -1, sizeof st);
  memset(en, -1, sizeof en);
  for (int i = 1, type, id; i <= q; i++) {
    scanf("%d", &type);
    if (type == 3) timer++;
    if (type == 2) {
      scanf("%d", &id);
      en[id] = timer;
    }
    if (type == 1) {
      ++m;
      scanf("%d%d", &v[m], &w[m]);
      st[m] = timer + 1;
    }
  }
  for (int i = 1; i <= m; i++)
    upd(i, (st[i] == -1 ? 1 : st[i]), (en[i] == -1 ? timer : en[i]));
  go();
  for (int i = 1; i <= timer; i++) printf("%d\n", ans[i]);
  return 0;
}
