#include <bits/stdc++.h>
using namespace std;
const int maxn = 41000;
const int p = 1e7 + 19;
const int q = 1e9 + 7;
int ed[maxn], st[maxn];
pair<int, int> item[maxn];
bool query[maxn];
int pro[maxn];
int k;
vector<int> add[maxn * 4];
void update(int l, int r, int rt, int tl, int tr, int node) {
  if (tl <= l && r <= tr) {
    add[rt].push_back(node);
    return;
  }
  int mid = (l + r) >> 1;
  if (tl <= mid) update(l, mid, rt << 1, tl, tr, node);
  if (tr >= mid + 1) update(mid + 1, r, rt << 1 | 1, tl, tr, node);
}
long long ksm(long long num, long long t) {
  long long res = 1;
  num %= q;
  for (; t; t >>= 1, num = num * num % q) {
    if (t & 1) res = res * num % q;
  }
  return res;
}
int tmp[1005];
void solve(int l, int r, int rt) {
  int buc[1005] = {0};
  for (int i = (0), iend = ((int)add[rt].size() - 1); i <= iend; i++) {
    int id = add[rt][i];
    for (int j = k; j >= 0; j--) {
      if (j + item[id].second <= k)
        tmp[j + item[id].second] =
            max(tmp[j + item[id].second], tmp[j] + item[id].first);
    }
  }
  if (l == r) {
    if (query[l]) {
      long long ans = 0;
      for (int m = (1), mend = (k); m <= mend; m++) {
        ans += 1ll * tmp[m] * pro[m - 1] % q;
        ans %= q;
      }
      printf("%lld\n", ans);
    }
    return;
  }
  int mid = (l + r) >> 1;
  memcpy(buc, tmp, sizeof(tmp));
  solve(l, mid, rt << 1);
  memcpy(tmp, buc, sizeof(tmp));
  solve(mid + 1, r, rt << 1 | 1);
}
int main() {
  for (int i = (0), iend = (1005); i <= iend; i++) pro[i] = ksm(p, i);
  int n;
  scanf("%d%d", &n, &k);
  for (int i = (1), iend = (n); i <= iend; i++) {
    scanf("%d%d", &item[i].first, &item[i].second);
    st[i] = 1;
  }
  int q;
  scanf("%d", &q);
  int item_cnt = n;
  for (int i = (1), iend = (q); i <= iend; i++) {
    int ty;
    scanf("%d", &ty);
    if (ty == 1) {
      ++item_cnt;
      scanf("%d%d", &item[item_cnt].first, &item[item_cnt].second);
      st[item_cnt] = i;
    } else if (ty == 2) {
      int x;
      scanf("%d", &x);
      ed[x] = i;
    } else
      query[i] = 1;
  }
  for (int i = (1), iend = (item_cnt); i <= iend; i++)
    if (!ed[i]) ed[i] = q;
  for (int i = (1), iend = (item_cnt); i <= iend; i++)
    update(1, q, 1, st[i], ed[i], i);
  solve(1, q, 1);
  return 0;
}
