#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long t = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') t = t * 10LL + c - 48LL, c = getchar();
  return t * f;
}
long long tim, n, w, cnt[50001];
long long mo = 1e9 + 7, p = 1e7 + 19;
long long dp[30][2001];
struct node {
  long long w, v, s, e;
} wu[200001];
inline void get(long long l, long long r, long long dep, vector<long long> Q) {
  for (long long i = 0; i <= w; ++i) dp[dep][i] = dp[dep - 1][i];
  if (!Q.empty())
    for (long long i = 0; i <= Q.size() - 1; ++i) {
      if (wu[Q[i]].s <= l && r <= wu[Q[i]].e) {
        for (long long j = w; j >= wu[Q[i]].w; --j)
          dp[dep][j] = max(dp[dep][j], dp[dep][j - wu[Q[i]].w] + wu[Q[i]].v);
      }
    }
  if (l == r) {
    if (!cnt[l]) return;
    long long ans = 0;
    for (long long i = w; i >= 1; --i) ans = (ans * p + dp[dep][i]) % mo;
    for (long long i = 1; i <= cnt[l]; ++i) printf("%I64d\n", ans);
    return;
  }
  vector<long long> L, R;
  long long mid = l + r >> 1;
  if (!Q.empty())
    for (long long i = 0; i <= Q.size() - 1; ++i) {
      if (wu[Q[i]].s <= l && r <= wu[Q[i]].e) continue;
      if (wu[Q[i]].s <= mid) L.push_back(Q[i]);
      if (wu[Q[i]].e > mid) R.push_back(Q[i]);
    }
  get(l, mid, dep + 1, L);
  get(mid + 1, r, dep + 1, R);
}
int main() {
  n = read();
  w = read();
  long long tim = 1;
  for (long long i = 1; i <= n; ++i) {
    wu[i].v = read();
    wu[i].w = read();
    wu[i].s = 1;
  }
  long long tot = n;
  int m = read();
  for (long long i = 1; i <= m; ++i) {
    long long opt = read();
    if (opt == 1) {
      tim++;
      wu[++tot].v = read();
      wu[tot].w = read();
      wu[tot].s = tim;
    } else if (opt == 2) {
      wu[read()].e = tim;
      tim++;
    } else
      cnt[tim]++;
  }
  vector<long long> Q;
  for (long long i = 1; i <= tot; ++i) {
    if (!wu[i].e) wu[i].e = tim;
    Q.push_back(i);
  }
  get(1, tim, 1, Q);
}
