#include <bits/stdc++.h>
using namespace std;
vector<int> tag[100100 << 2];
long long tmp[20][1010];
int n, ans[100100], k, m, q, val[100100], cost[100100], qes[100100], st[100100],
    ed[100100];
void update(int rt, int l, int r, int L, int R, int id) {
  if (L > R) return;
  if (l >= L && r <= R) {
    tag[rt].push_back(id);
    return;
  }
  if (L <= ((l + r) >> 1)) update(rt << 1, l, ((l + r) >> 1), L, R, id);
  if (R > ((l + r) >> 1)) update(rt << 1 | 1, ((l + r) >> 1) + 1, r, L, R, id);
}
void Max(long long &f, long long g) {
  if (f < g) f = g;
}
void dfs(int rt, int l, int r, int dep) {
  memcpy(tmp[dep], tmp[dep - 1], sizeof tmp[dep]);
  int sz = tag[rt].size();
  for (int i = 0; i <= sz - 1; i++) {
    int id = tag[rt][i];
    for (int j = k; j >= cost[id]; j--)
      Max(tmp[dep][j], tmp[dep][j - cost[id]] + val[id]);
  }
  if (l == r) {
    for (int i = k; i >= 1; i--)
      ans[l] = (1LL * ans[l] * 10000019 + tmp[dep][i]) % 1000000007;
    return;
  }
  dfs(rt << 1, l, ((l + r) >> 1), dep + 1);
  dfs(rt << 1 | 1, ((l + r) >> 1) + 1, r, dep + 1);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d", val + i, cost + i), st[i] = 0;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int opt, x;
    scanf("%d", &opt);
    if (opt == 1) ++n, scanf("%d%d", val + n, cost + n), st[n] = i;
    if (opt == 2) scanf("%d", &x), ed[x] = i;
    if (opt == 3) qes[++*qes] = i;
  }
  for (int i = 1; i <= n; i++) {
    st[i] = upper_bound(qes + 1, qes + *qes + 1, st[i]) - qes;
    if (ed[i])
      ed[i] = upper_bound(qes + 1, qes + *qes + 1, ed[i]) - qes - 1;
    else
      ed[i] = *qes;
  }
  for (int i = 1; i <= n; i++) update(1, 1, *qes, st[i], ed[i], i);
  dfs(1, 1, *qes, 1);
  for (int i = 1; i <= *qes; i++) printf("%d\n", ans[i]);
}
