#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7, P = 1e7 + 19;
const int N = 200005;
int nt = 1, k, n, Q, x, y, tot, op;
long long pm(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = res * x % M;
    p >>= 1;
    x = x * x % M;
  }
  return res;
}
struct node {
  int l, r, v, w;
} q[N << 2];
int qc[N];
vector<int> a;
long long f[50][2000];
void cdq(int l, int r, int d, vector<int> a) {
  if (d > 1) {
    for (int i = 1; i <= k; i++) f[d][i] = f[d - 1][i];
  }
  for (int i = 0; i < (int)a.size(); ++i)
    if (q[a[i]].l <= l && r <= q[a[i]].r) {
      for (int j = k; j >= q[a[i]].w; j--) {
        f[d][j] = max(f[d][j], f[d][j - q[a[i]].w] + q[a[i]].v);
      }
    }
  if (l == r) {
    long long res = 0;
    for (int i = k; i >= 1; i--) {
      res = (res * P + f[d][i]) % M;
    }
    for (int i = 1; i <= qc[l]; i++) {
      printf("%I64d\n", res);
    }
    return;
  }
  int mid = l + r >> 1;
  vector<int> la, ra;
  for (int i = 0; i < (int)a.size(); ++i) {
    if (q[a[i]].l <= l && r <= q[a[i]].r) continue;
    if (q[a[i]].r <= mid) {
      la.push_back(a[i]);
    } else if (q[a[i]].l > mid) {
      ra.push_back(a[i]);
    } else {
      la.push_back(a[i]);
      ra.push_back(a[i]);
    }
  }
  cdq(l, mid, d + 1, la);
  cdq(mid + 1, r, d + 1, ra);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    q[++tot] = (node){1, 0, x, y};
  }
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d", &op);
    if (op == 1) {
      ++tot;
      ++nt;
      scanf("%d%d", &x, &y);
      q[tot] = (node){nt, 0, x, y};
    } else if (op == 2) {
      scanf("%d", &x);
      q[x].r = nt;
      ++nt;
    } else {
      qc[nt]++;
    }
  }
  for (int i = 1; i <= tot; i++) {
    a.push_back(i);
    if (q[i].r == 0) q[i].r = nt;
  }
  cdq(1, nt, 1, a);
  return 0;
}
