#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e4 + 7;
const int maxk = 1e3 + 7;
const int base = 1e7 + 19;
const int MOD = 1e9 + 7;
struct exhibits {
  int v, w, l, r;
} exb[maxn];
int k;
vector<pair<int, int> > seg[maxn << 2];
long long DP[maxk];
int qr();
void add(int p, int l, int r, int ql, int qr, int v, int w) {
  if (ql <= l && r <= qr) {
    seg[p].push_back(make_pair(v, w));
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) add(p << 1, l, mid, ql, qr, v, w);
  if (mid < qr) add(p << 1 | 1, mid + 1, r, ql, qr, v, w);
}
void solve(int p, int l, int r, long long* dp) {
  for (vector<pair<int, int> >::iterator pp = seg[p].begin();
       pp != seg[p].end(); pp++)
    for (int j = k; j >= pp->second; j--)
      dp[j] = max(dp[j], dp[j - pp->second] + pp->first);
  if (l == r) {
    long long ans = 0;
    for (int i = k; i; i--) ans = (ans * base + dp[i]) % MOD;
    printf("%lld\n", ans);
    return;
  }
  int mid = (l + r) >> 1;
  long long f[maxk];
  memcpy(f, dp, sizeof(f));
  solve(p << 1, l, mid, f);
  memcpy(f, dp, sizeof(f));
  solve(p << 1 | 1, mid + 1, r, f);
}
int main() {
  int n, q, opt, u, v, t = 1;
  n = qr();
  k = qr();
  for (int i = 1; i <= n; i++) {
    u = qr();
    v = qr();
    exb[i] = (exhibits){u, v, t, -1};
  }
  scanf("%d", &q);
  while (q--) {
    opt = qr();
    if (opt == 1) {
      u = qr();
      v = qr();
      exb[++n] = (exhibits){u, v, t, -1};
    } else if (opt == 2)
      exb[qr()].r = t - 1;
    else
      t++;
  }
  t--;
  for (int i = 1; i <= n; i++) {
    exb[i].r = exb[i].r == -1 ? t : exb[i].r;
    if (exb[i].l <= exb[i].r)
      add(1, 1, t, exb[i].l, exb[i].r, exb[i].v, exb[i].w);
  }
  solve(1, 1, t, DP);
  return 0;
}
inline int qr() {
  int num = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) num = (num << 1) + (num << 3) + ch - 48, ch = getchar();
  return num;
}
