#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
vector<long long> g;
const long long bas = 10000019, mod = 1000000007, N = 100010;
struct data {
  long long v, w, s, t;
} a[N];
long long n, m, tim, f[40][N], mark[N], cnt, Q;
void work(long long l, long long r, vector<long long> g, long long dep) {
  for (long long i = 1; i <= m; ++i) f[dep][i] = f[dep - 1][i];
  for (long long i = 0; i < g.size(); i++)
    if (a[g[i]].s <= l && a[g[i]].t >= r)
      for (long long j = m; j >= a[g[i]].w; --j)
        f[dep][j] = max(f[dep][j], f[dep][j - a[g[i]].w] + a[g[i]].v);
  if (l == r) {
    if (mark[l]) {
      long long ans = 0;
      for (long long i = m; i >= 1; --i) ans = (ans * bas + f[dep][i]) % mod;
      writeln(ans);
    }
    return;
  } else {
    long long mid = (l + r) >> 1;
    vector<long long> ls, rs;
    for (long long i = 0; i < g.size(); i++) {
      if (a[g[i]].s <= l && a[g[i]].t >= r) continue;
      if (a[g[i]].t <= mid)
        ls.push_back(g[i]);
      else if (a[g[i]].s > mid)
        rs.push_back(g[i]);
      else
        ls.push_back(g[i]), rs.push_back(g[i]);
    }
    work(l, mid, ls, dep + 1);
    work(mid + 1, r, rs, dep + 1);
  }
}
int main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; ++i)
    a[++cnt].v = read(), a[cnt].w = read(), a[cnt].s = 1;
  Q = read();
  for (long long i = 1; i <= Q; ++i) {
    long long opt = read();
    if (opt == 1) a[++cnt].v = read(), a[cnt].w = read(), a[cnt].s = i;
    if (opt == 2) a[read()].t = i;
    if (opt == 3) mark[i] = 1;
  }
  for (long long i = 1; i <= cnt; ++i)
    if (!a[i].t) a[i].t = Q;
  for (long long i = 1; i <= cnt; ++i) g.push_back(i);
  work(1, Q, g, 1);
}
