#include <bits/stdc++.h>
using namespace std;
const int maxn = 40000, maxm = 2100000, maxk = 1013;
int n, k, Q, w[maxn], v[maxn], ins[maxn], del[maxn], ty, x;
bool isq[maxn];
vector<int> tag[maxm];
void modify(int t, int l, int r, int x, int y, int o) {
  if (l >= x && r <= y) {
    tag[t].push_back(o);
    return;
  }
  if (x <= ((l + r) >> 1)) modify((t << 1), l, ((l + r) >> 1), x, y, o);
  if (y > ((l + r) >> 1))
    modify(((t << 1) | 1), ((l + r) >> 1) + 1, r, x, y, o);
}
void ask(int t, int l, int r, int s[]) {
  int st[1010];
  for (int i = 1; i <= k; i++) st[i] = s[i];
  for (int i = 0; i < (int)tag[t].size(); i++) {
    int o = tag[t][i];
    for (int j = k; j >= w[o]; j--) st[j] = max(st[j], st[j - w[o]] + v[o]);
  }
  if (l == r) {
    if (isq[l]) {
      int ans = 0;
      for (int i = 1, pp = 1; i <= k;
           i++, pp = (long long)pp * 10000019 % 1000000007)
        ans = (ans + (long long)pp * st[i] % 1000000007) % 1000000007;
      printf("%d\n", ans);
    }
    return;
  }
  ask((t << 1), l, ((l + r) >> 1), st);
  ask(((t << 1) | 1), ((l + r) >> 1) + 1, r, st);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", v + i, w + i);
    ins[i] = i;
  }
  scanf("%d", &Q);
  int tim = n + 1;
  for (int i = 1; i <= Q; i++, tim++) {
    scanf("%d", &ty);
    if (ty == 1) {
      n++;
      scanf("%d%d", v + n, w + n);
      ins[n] = tim;
    } else if (ty == 2) {
      scanf("%d", &x);
      del[x] = tim;
    } else
      isq[tim] = 1;
  }
  for (int i = 1; i <= n; i++)
    if (!del[i]) del[i] = tim;
  for (int i = 1; i <= n; i++) modify(1, 1, tim, ins[i], del[i], i);
  int s[1010];
  memset(s, 0, sizeof(s));
  ask(1, 1, tim, s);
  return 0;
}
