#include <bits/stdc++.h>
template <typename T>
bool Chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool Chkmin(T &x, T y) {
  return y < x ? x = y, true : false;
}
const int MAXN = 3e4 + 1e3, MAXNODE = MAXN * 20, MAXEDGE = MAXN * 20,
          MAXK = 1e3 + 1e2, PP = 1e7 + 19, MOD = 1e9 + 7, oo = 0x3f3f3f3f;
int n, k, q, totq;
int be[MAXNODE], ed[MAXNODE];
int w[MAXN];
int val[MAXN];
int head[MAXNODE], next[MAXEDGE];
int to[MAXEDGE];
int ans[MAXN];
int top;
int dp[20][MAXNODE];
inline void Mod(int &x) { x = (x % MOD + MOD) % MOD; }
inline void AddEdge(int u, int v) {
  static int tote;
  ++tote;
  to[tote] = v;
  next[tote] = head[u];
  head[u] = tote;
}
namespace SMT {
void Exec(int o = 1, int l = 1, int r = totq) {
  ++top;
  int *f = dp[top];
  for (int i = 0, _ = k; i <= _; i++) f[i] = dp[top - 1][i];
  for (int i = head[o]; i; i = next[i]) {
    int v = to[i];
    for (int j = k, _ = w[v]; j >= _; j--) Chkmax(f[j], f[j - w[v]] + val[v]);
  }
  int mid = (l + r) / 2;
  if (l != r) {
    Exec((o * 2), l, mid);
    Exec((o * 2 + 1), mid + 1, r);
  } else {
    int tmp = 1;
    for (int i = 1, _ = k; i <= _; i++) {
      Mod(ans[mid] += (long long)f[i] * tmp % MOD);
      tmp = (long long)tmp * PP % MOD;
    }
  }
  --top;
}
void Add(int o, int l, int r, int L, int R, int X) {
  int mid = (l + r) / 2;
  if (L <= l && r <= R)
    AddEdge(o, X);
  else {
    if (L <= mid) Add((o * 2), l, mid, L, R, X);
    if (mid < R) Add((o * 2 + 1), mid + 1, r, L, R, X);
  }
}
inline void Add(int l, int r, int x) {
  if (l <= r) Add(1, 1, totq, l, r, x);
}
}  // namespace SMT
void Solve() {
  for (int i = 1, _ = n; i <= _; i++) {
    SMT::Add(be[i], ed[i], i);
  }
  SMT::Exec();
  for (int i = 1, _ = totq; i <= _; i++) printf("%d\n", ans[i]);
}
void Input() {
  scanf("%d%d", &n, &k);
  for (int i = 1, _ = n; i <= _; i++) {
    scanf("%d%d", &val[i], &w[i]);
    be[i] = 1, ed[i] = oo;
  }
  scanf("%d", &q);
  for (int i = 1, _ = q; i <= _; i++) {
    int type, x;
    scanf("%d", &type);
    if (type == 1) {
      ++n;
      scanf("%d%d", &val[n], &w[n]);
      be[n] = totq + 1, ed[n] = oo;
    } else if (type == 2) {
      scanf("%d", &x);
      ed[x] = totq;
    } else
      ++totq;
  }
}
int main() {
  if (fopen("E.in", "r") != NULL) {
    freopen("E.in", "r", stdin);
    freopen("E.out", "w", stdout);
  }
  Input();
  Solve();
  return 0;
}
