#include <bits/stdc++.h>
using namespace std;
const int N = 30005, M = 1e9 + 7, P = 1e7 + 19;
int n, m, a[N], b[N], last[N], first[N], opt, flag[N], tot, Stack[20][N], x, q;
struct Tree {
  int l, r;
  vector<pair<int, int> > v;
} T[N * 4];
void build(int x, int l, int r) {
  T[x].l = l;
  T[x].r = r;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
}
void insert(int x, int l, int r, pair<int, int> z) {
  if (T[x].l > r || l > T[x].r) return;
  if (T[x].l >= l && T[x].r <= r) {
    T[x].v.push_back(z);
    return;
  }
  insert(x * 2, l, r, z);
  insert(x * 2 + 1, l, r, z);
}
inline void upd(int &x, int y) {
  if (x < y) x = y;
}
void solve(int x) {
  tot++;
  memcpy(Stack[tot], Stack[tot - 1], sizeof Stack[tot]);
  for (pair<int, int> i : T[x].v)
    for (int j = m; j >= i.second; j--)
      upd(Stack[tot][j], Stack[tot][j - i.second] + i.first);
  if (T[x].l == T[x].r) {
    if (flag[T[x].l]) {
      int ans = 0, s = 1;
      for (int i = 1; i <= m; i++)
        ans = (ans + (long long)s * Stack[tot][i]) % M,
        s = (long long)s * P % M;
      printf("%d\n", ans);
    }
  } else {
    solve(x * 2);
    solve(x * 2 + 1);
  }
  tot--;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i], &b[i]), first[i] = 1;
  scanf("%d", &q);
  for (int i = 1; i <= n; i++) last[i] = q;
  build(1, 1, q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &opt);
    if (opt == 1) {
      n++;
      scanf("%d%d", &a[n], &b[n]);
      first[n] = i;
      last[n] = q;
    }
    if (opt == 2) {
      scanf("%d", &x);
      last[x] = i - 1;
    }
    if (opt == 3) flag[i] = 1;
  }
  for (int i = 1; i <= n; i++)
    insert(1, first[i], last[i], make_pair(a[i], b[i]));
  solve(1);
  return 0;
}
