#include <bits/stdc++.h>
using namespace std;
const int P = 1e7 + 19;
const int MOD = 1e9 + 7;
const int maxn = 44444;
const int maxh = 18;
int m = 0, n, K, x, Q, type, v[maxn], w[maxn], l[maxn], r[maxn], ans[maxn];
long long dp[maxn], backup[maxh][maxn];
vector<int> tr[maxn * 2];
inline int getnode(int l, int r) { return (l + r) | (l != r); }
void add(int l, int r, int a, int b, int id) {
  if (a > r || b < l) return;
  int k = getnode(l, r);
  if (a <= l && r <= b) {
    tr[k].push_back(id);
    return;
  }
  int mid = l + r >> 1;
  add(l, mid, a, b, id);
  add(mid + 1, r, a, b, id);
}
void dfs(int l, int r, int dep) {
  int k = getnode(l, r);
  for (int i = 0; i <= K; ++i) backup[dep][i] = dp[i];
  for (int i = 0; i < tr[k].size(); ++i) {
    int x = tr[k][i];
    for (int j = K; j >= w[x]; --j) dp[j] = max(dp[j], dp[j - w[x]] + v[x]);
  }
  if (l == r) {
    ans[l] = 0;
    int tmp = 1;
    for (int i = 1; i <= K; ++i, tmp = (long long)tmp * P % MOD)
      ans[l] = ((long long)dp[i] % MOD * tmp + ans[l]) % MOD;
    for (int i = 0; i <= K; ++i) dp[i] = backup[dep][i];
    return;
  }
  int mid = l + r >> 1;
  dfs(l, mid, dep + 1);
  dfs(mid + 1, r, dep + 1);
  for (int i = 0; i <= K; ++i) dp[i] = backup[dep][i];
}
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &v[i], &w[i]);
  scanf("%d", &Q);
  for (int i = 1; i <= n; ++i) l[i] = 1, r[i] = Q;
  for (int i = 1; i <= Q; ++i) {
    scanf("%d", &type);
    if (type == 1) {
      n++;
      scanf("%d%d", &v[n], &w[n]);
      l[n] = m + 1;
      r[n] = Q;
    }
    if (type == 2) {
      scanf("%d", &x);
      r[x] = m;
    }
    if (type == 3) {
      m++;
    }
  }
  for (int i = 1; i <= n; ++i) r[i] = min(r[i], m);
  for (int i = 1; i <= n; ++i) {
    if (l[i] <= r[i]) add(1, m, l[i], r[i], i);
  }
  memset(dp, 0, sizeof(dp));
  dfs(1, m, 1);
  for (int i = 1; i <= m; ++i) printf("%d\n", ans[i]);
}
