#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 333;
const long long linf = 1e18 + inf;
const int N = 35000 + 5;
const int K = 1000 + 5;
int n, k, q;
int a[N], b[N], st[N], nd[N], tme[N], ans[N], dp[K];
vector<pair<int, int> > t[N << 2];
void add(int x, int l, int r, int x1, int x2, int a, int b) {
  if (x2 < l or r < x1) return;
  if (x1 <= l and r <= x2) {
    t[x].push_back(pair<int, int>(a, b));
    return;
  }
  int m = (l + r) >> 1;
  add(x + x, l, m, x1, x2, a, b);
  add(x + x + 1, m + 1, r, x1, x2, a, b);
}
void solve(int x, int l, int r) {
  vector<int> backup;
  for (int i = 0; i <= k; i++) {
    backup.push_back(dp[i]);
  }
  for (__typeof((t[x]).begin()) it = (t[x]).begin(); it != (t[x]).end(); it++) {
    int a = it->first;
    int b = it->second;
    for (int i = k; i >= b; i--) {
      dp[i] = max(dp[i], dp[i - b] + a);
    }
  }
  if (l == r) {
    for (int i = k; i >= 1; i--) {
      ans[l] = ((long long)ans[l] * (int)(1e7 + 19) + dp[i]) % (int)(1e9 + 7);
    }
  } else {
    int m = (l + r) >> 1;
    solve(x + x, l, m);
    solve(x + x + 1, m + 1, r);
  }
  for (int i = 0; i <= k; i++) dp[i] = backup[i];
  backup.clear();
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", a + i, b + i);
    st[i] = 1;
    nd[i] = N - 1;
  }
  scanf("%d", &q);
  vector<int> v;
  int cnt = n;
  for (int i = 1; i <= q; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      ++cnt;
      scanf("%d %d", a + cnt, b + cnt);
      st[cnt] = i + n;
      nd[cnt] = N - 1;
    } else if (type == 2) {
      int x;
      scanf("%d", &x);
      nd[x] = i - 1 + n;
    } else {
      v.push_back(i + n);
    }
  }
  for (int i = 1; i <= cnt; i++) {
    add(1, 1, N - 1, st[i], nd[i], a[i], b[i]);
  }
  solve(1, 1, N - 1);
  for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
    int x = *it;
    printf("%d\n", ans[x]);
  }
  return 0;
}
