#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, P = 10000000 + 19;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 30100;
int dp[30][N];
int n, k, st[N], ed[N], ty, it, qur[N], q;
pair<int, int> p[N];
vector<int> ps;
void query(int d, int l, int r, vector<int> item) {
  for (int i = 0; i < k + 1; i++) dp[d][i] = dp[d - 1][i];
  for (int j = 0; j < ((int)(item).size()); j++)
    if (st[item[j]] <= l && ed[item[j]] >= r) {
      int v = p[item[j]].first, w = p[item[j]].second;
      for (int i = k + 1 - 1; i >= 0; i--) {
        if (i >= w) dp[d][i] = max(dp[d][i], dp[d][i - w] + v);
      }
    }
  if (l == r) {
    long long ret = 0;
    for (int i = k + 1 - 1; i >= 1; i--) ret = (ret * P + dp[d][i]) % mod;
    for (int j = 0; j < qur[l]; j++) printf("%d\n", (int)ret);
  } else {
    int md = (l + r) >> 1;
    vector<int> lt, rt;
    for (int j = 0; j < ((int)(item).size()); j++) {
      if (st[item[j]] <= l && ed[item[j]] >= r) continue;
      if (ed[item[j]] <= md)
        lt.push_back(item[j]);
      else if (st[item[j]] > md)
        rt.push_back(item[j]);
      else
        lt.push_back(item[j]), rt.push_back(item[j]);
    }
    query(d + 1, l, md, lt);
    query(d + 1, md + 1, r, rt);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n + 1; i++)
    scanf("%d%d", &p[i].first, &p[i].second), st[i] = 1;
  scanf("%d", &q);
  int cur = 1, im = n;
  for (int i = 0; i < q; i++) {
    scanf("%d", &ty);
    if (ty == 3) {
      qur[cur]++;
    } else if (ty == 2) {
      scanf("%d", &it);
      ed[it] = cur++;
    } else {
      im++;
      scanf("%d%d", &p[im].first, &p[im].second);
      st[im] = ++cur;
    }
  }
  for (int i = 1; i < im + 1; i++) ps.push_back(i);
  for (int i = 1; i < im + 1; i++)
    if (ed[i] == 0) ed[i] = cur;
  query(1, 1, cur, ps);
}
