#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30005;
const int p = 1e7 + 19;
const int mod = 1e9 + 7;
vector<int> G[MAXN << 2];
int dp[30][1005];
int st[MAXN];
int ed[MAXN];
int op[MAXN];
int w[MAXN];
int v[MAXN];
int n, V, q;
int cnt;
void upd(int& x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void update(int L, int R, int idx, int o, int l, int r) {
  if (L <= l && r <= R) {
    G[o].push_back(idx);
    return;
  }
  int m = ((l + r) >> 1);
  if (L <= m) update(L, R, idx, (o << 1), l, m);
  if (m < R) update(L, R, idx, (o << 1 | 1), m + 1, r);
}
void down(int d, int o, int l, int r) {
  for (int i = 1; i <= V; ++i) {
    dp[d][i] = dp[d - 1][i];
  }
  for (int i = 0; i < G[o].size(); ++i) {
    int x = G[o][i], cost = v[x], val = w[x];
    for (int j = V; j >= cost; --j) {
      dp[d][j] = max(dp[d][j], dp[d][j - cost] + val);
    }
  }
  if (l == r) {
    int ans = 0, t = 1;
    if (op[l] == 3) {
      for (int i = 1; i <= V; ++i) {
        upd(ans, 1LL * t * dp[d][i] % mod);
        t = 1LL * t * p % mod;
      }
      printf("%d\n", ans);
    }
    return;
  }
  int m = ((l + r) >> 1);
  down(d + 1, (o << 1), l, m);
  down(d + 1, (o << 1 | 1), m + 1, r);
}
void solve() {
  int x, y;
  cnt = n;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &w[i], &v[i]);
  }
  scanf("%d", &q);
  for (int i = 1; i <= n; ++i) {
    st[i] = 1;
    ed[i] = q;
  }
  for (int i = 1; i <= q; ++i) {
    scanf("%d", &op[i]);
    if (op[i] == 1) {
      scanf("%d%d", &x, &y);
      ++cnt;
      w[cnt] = x;
      v[cnt] = y;
      st[cnt] = i;
      ed[cnt] = q;
    } else if (op[i] == 2) {
      scanf("%d", &x);
      ed[x] = i;
    }
  }
  for (int i = 0; i < q << 2; ++i) {
    G[i].clear();
  }
  for (int i = 1; i <= cnt; ++i) {
    update(st[i], ed[i], i, 1, 1, q);
  }
  memset(dp, 0, sizeof dp);
  down(1, 1, 1, q);
}
int main() {
  while (~scanf("%d%d", &n, &V)) solve();
  return 0;
}
