#include <bits/stdc++.h>
const int maxn = 50050, logN = 18, maxk = 1005;
const int Mod = 1e9 + 7, base = 1e7 + 19;
int N, K, Q;
bool ext[maxn << 2];
int head[maxn << 2], size;
std::pair<int, int> point[maxn * logN], item[maxn];
int bag[logN][maxk];
int type[maxn], st[maxn], ed[maxn], tot;
int ans[maxn], L;
int newitem(int id, int x) {
  point[++size] = std::make_pair(x, head[id]), head[id] = size;
}
void build(int l, int r, int p) {
  if (l == r)
    ext[p] = type[l] == 3;
  else {
    int mid = (l + r) >> 1;
    build(l, mid, p << 1);
    build(mid + 1, r, p << 1 | 1);
    ext[p] = ext[p << 1] || ext[p << 1 | 1];
  }
}
void insert(int l, int r, int it, int ll, int rr, int p) {
  if (l == ll && r == rr)
    newitem(p, it);
  else {
    int mid = (ll + rr) >> 1;
    if (l > mid)
      insert(l, r, it, mid + 1, rr, p << 1 | 1);
    else if (r <= mid)
      insert(l, r, it, ll, mid, p << 1);
    else {
      insert(l, mid, it, ll, mid, p << 1);
      insert(mid + 1, r, it, mid + 1, rr, p << 1 | 1);
    }
  }
}
int count(int *A) {
  long long p = 1, ret = 0;
  for (int i = 1; i <= K; i++) {
    ret += p * A[i] % Mod, (p *= base) %= Mod;
  }
  return (int)(ret % Mod);
}
void add(int s, int *A) {
  int v = item[s].first, w = item[s].second;
  for (int i = K; i >= w; i--) A[i] = std::max(A[i - w] + v, A[i]);
}
void solve(int l, int r, int p, int dep) {
  if (ext[p] == 0) return;
  int *F = bag[dep], *G = bag[dep - 1];
  for (int i = 0; i <= K; i++) F[i] = G[i];
  for (int i = head[p]; i; i = point[i].second) add(point[i].first, F);
  if (l == r)
    ans[++L] = count(F);
  else {
    int mid = (l + r) >> 1;
    solve(l, mid, p << 1, dep + 1);
    solve(mid + 1, r, p << 1 | 1, dep + 1);
  }
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 1, v, w; i <= N; i++) {
    scanf("%d%d", &v, &w);
    item[i] = std::make_pair(v, w);
  }
  tot = N;
  scanf("%d", &Q);
  for (int i = 1; i <= N; i++) st[i] = 1, ed[i] = Q;
  for (int i = 1, x, y; i <= Q; i++) {
    scanf("%d", &type[i]);
    if (type[i] == 1) {
      scanf("%d%d", &x, &y);
      item[++tot] = std::make_pair(x, y);
      st[tot] = i, ed[tot] = Q;
    } else if (type[i] == 2) {
      scanf("%d", &x);
      ed[x] = i;
    }
  }
  build(1, Q, 1);
  for (int i = 1; i <= tot; i++) {
    if (i <= N)
      insert(st[i], ed[i], i, 1, Q, 1);
    else
      insert(st[i], ed[i], i, 1, Q, 1);
  }
  solve(1, Q, 1, 1);
  for (int i = 1; i <= L; i++) printf("%d\n", ans[i]);
  return 0;
}
