#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long P = 1e7 + 19;
int n, q;
long long k;
struct obj {
  long long v;
  int w;
  int fir, en;
} e[40010];
int num, sf[30010];
vector<int> tree[30010 << 2];
void opt1(int o, int l, int r, int L, int R, int x) {
  if (l >= L && r <= R) {
    tree[o].push_back(x);
    return;
  }
  int mid = (l + r) >> 1;
  if (mid >= L) opt1(o << 1, l, mid, L, R, x);
  if (mid < R) opt1(o << 1 | 1, mid + 1, r, L, R, x);
}
long long dp[1010];
long long ksm(long long x, long long y) {
  long long maretu = 1;
  for (; y; y >>= 1) {
    if (y & 1) {
      maretu = maretu * x % MOD;
    }
    x = x * x % MOD;
  }
  return maretu;
}
long long mi[400010];
void dfs(int o, int l, int r) {
  long long now[1010];
  for (int i = 0; i < tree[o].size(); ++i) {
    for (int j = k; j >= e[tree[o][i]].w; --j) {
      now[j] = dp[j] = max(dp[j], dp[j - e[tree[o][i]].w] + e[tree[o][i]].v);
    }
  }
  memcpy(now, dp, sizeof(dp));
  if (l == r) {
    if (sf[l] == 0) return;
    long long ans = 0;
    for (int i = 1; i <= k; ++i) {
      ans += dp[i] * mi[i - 1];
      ans %= MOD;
    }
    printf("%lld\n", ans);
    return;
  }
  int mid = (l + r) >> 1;
  dfs(o << 1, l, mid);
  memcpy(dp, now, sizeof(now));
  dfs(o << 1 | 1, mid + 1, r);
}
int main() {
  scanf("%d%lld", &n, &k);
  mi[0] = 1;
  for (int i = 1; i <= k; ++i) {
    mi[i] = mi[i - 1] * P % MOD;
  }
  for (int i = 1; i <= n; ++i) {
    ++num;
    scanf("%lld%d", &e[num].v, &e[num].w);
    e[num].fir = 1;
  }
  scanf("%d", &q);
  for (int i = 1; i <= n + q; ++i) {
    e[i].en = q;
  }
  for (int i = 1; i <= q; ++i) {
    int opt;
    scanf("%d", &opt);
    if (opt == 1) {
      ++num;
      scanf("%lld%d", &e[num].v, &e[num].w);
      e[num].fir = i;
    }
    if (opt == 2) {
      int x;
      scanf("%d", &x);
      e[x].en = i;
    }
    if (opt == 3) sf[i] = 1;
  }
  for (int i = 1; i <= num; ++i) {
    opt1(1, 1, q, e[i].fir, e[i].en, i);
  }
  dfs(1, 1, q);
}
