#include <bits/stdc++.h>
using namespace std;
const int N = 40005;
const int M = 1005;
const int Q = 1000000007;
const int P = 10000019;
int n, m, q, tot;
int v[N], w[N], Ask[N], f[N], id[N];
int g[M], dp[N * 4];
vector<int> T[N * 4];
void Build(int s, int x, int y, int l, int r, int k) {
  if (l <= x && y <= r) {
    T[s].push_back(k);
    return;
  }
  int Mid = (x + y) / 2;
  int t = s + s;
  if (l <= Mid) Build(t, x, Mid, l, r, k);
  if (Mid < r) Build(t + 1, Mid + 1, y, l, r, k);
}
void Make(int s, int x, int y) {
  if (x == y) {
    dp[s] = Ask[x];
    return;
  }
  int Mid = (x + y) / 2;
  int t = s + s;
  Make(t, x, Mid);
  Make(t + 1, Mid + 1, y);
  dp[s] = dp[t] | dp[t + 1];
}
void Add(int dp[M], int y, int x) {
  for (int i = m; i >= x; i--) dp[i] = max(dp[i], dp[i - x] + y);
}
void print() {
  int Ans = 0;
  for (int i = m; i; i--) Ans = (1LL * P * Ans + g[i]) % Q;
  printf("%d\n", Ans);
}
void Work(int s, int x, int y) {
  if (!dp[s]) return;
  int Mid = (x + y) / 2;
  int tmp[N];
  for (int i = 0; i <= m; i++) tmp[i] = g[i];
  for (int j = 0; j < T[s].size(); j++) Add(g, v[T[s][j]], w[T[s][j]]);
  if (x == y) {
    print();
    for (int i = 0; i <= m; i++) g[i] = tmp[i];
    return;
  }
  int t = s + s;
  Work(t, x, Mid);
  Work(t + 1, Mid + 1, y);
  for (int i = 0; i <= m; i++) g[i] = tmp[i];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &v[i], &w[i]);
    f[i] = 1;
    id[i] = i;
  }
  scanf("%d", &q);
  tot = n;
  for (int i = 1; i <= q; i++) {
    int x;
    scanf("%d", &x);
    if (x == 1) {
      tot++;
      scanf("%d%d", &v[tot], &w[tot]);
      f[tot] = 1;
      id[tot] = n + i;
    } else if (x == 2) {
      int y;
      scanf("%d", &y);
      Build(1, 1, n + q, id[y], n + i, y);
      f[y] = 0;
    } else if (x == 3) {
      Ask[n + i] = 1;
    }
  }
  for (int i = 1; i <= n; i++)
    if (f[i]) Add(g, v[i], w[i]);
  for (int i = n + 1; i <= tot; i++)
    if (f[i]) Build(1, 1, n + q, id[i], n + q, i);
  Make(1, 1, n + q);
  Work(1, 1, n + q);
  return 0;
}
