#include <bits/stdc++.h>
using namespace std;
template <class T>
void Read(T& x) {
  x = 0;
  int flag = 0, sgn = 1;
  char c;
  while (c = getchar()) {
    if (c == '-')
      sgn = -1;
    else if (c >= '0' && c <= '9')
      x *= 10, x += c - '0', flag = 1;
    else if (flag)
      break;
  }
  x *= sgn;
}
const int MAXN = 20000, MAXK = 1010;
const int p = 1e7 + 19, q = 1e9 + 7;
pair<int, int> vm[MAXN], zeit[MAXN];
int dp[30][MAXK], n, k, Q;
vector<int> query;
int tot = 0;
struct Segment_Tree {
  int first[40 * MAXN], next[40 * MAXN], e, to[40 * MAXN];
  Segment_Tree() {
    memset(first, -1, sizeof(first));
    e = 0;
  }
  void addEdge(int u, int v) {
    ++e;
    next[e] = first[u];
    first[u] = e;
    to[e] = v;
  }
  void add(int now, int l, int r, int ql, int qr, int v) {
    if (ql > qr) return;
    if (ql <= l && qr >= r) {
      addEdge(now, v);
      return;
    }
    int mid = (l + r) >> 1;
    if (ql <= mid) add(now << 1, l, mid, ql, qr, v);
    if (qr > mid) add(now << 1 | 1, mid + 1, r, ql, qr, v);
  }
  void solve(int now, int l, int r, int dep) {
    memcpy(dp[dep], dp[dep - 1], sizeof(dp[dep - 1]));
    for (int i = first[now]; i != -1; i = next[i]) {
      int v = to[i];
      for (int j = k; j >= vm[v].second; j--)
        dp[dep][j] = max(dp[dep][j], dp[dep][j - vm[v].second] + vm[v].first);
    }
    if (l == r) {
      long long ans = 0, tmp = 1;
      for (int i = 1; i <= k; i++) {
        ans = (ans + dp[dep][i] * tmp % q) % q;
        tmp = tmp * p % q;
      }
      printf("%d\n", ans);
      return;
    }
    int mid = (l + r) >> 1;
    solve(now << 1, l, mid, dep + 1);
    solve(now << 1 | 1, mid + 1, r, dep + 1);
  }
} T;
int main() {
  Read(n), Read(k);
  for (int i = 1; i <= n; i++) {
    ++tot;
    int v, w;
    Read(v), Read(w);
    vm[tot].first = v, vm[tot].second = w;
    zeit[tot].first = 1;
    zeit[tot].second = -1;
  }
  Read(Q);
  int lover = 0;
  for (int i = 1; i <= Q; i++) {
    int op;
    Read(op);
    if (op == 1) {
      int v, w;
      Read(v), Read(w);
      vm[++tot] = make_pair(v, w);
      zeit[tot].first = lover + 1;
      zeit[tot].second = -1;
    } else if (op == 2) {
      int x;
      Read(x);
      zeit[x].second = lover;
    } else
      lover++;
  }
  for (int i = 1; i <= tot; i++) {
    if (zeit[i].second == -1) zeit[i].second = lover;
    T.add(1, 1, lover, zeit[i].first, zeit[i].second, i);
  }
  T.solve(1, 1, lover, 1);
}
