#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int _runtimeTerror_() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n + 1), y(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
  }
  vector<int> psum(m + 5), last(n + 1);
  const int B = 500;
  vector<vector<int>> tmp(B + 1, vector<int>(B + 1));
  for (int i = 1; i <= m; ++i) {
    int op, k;
    cin >> op >> k;
    if (op == 1) {
      if (y[k] + x[k] > B) {
        for (int cur = i + x[k]; cur <= m; cur += x[k] + y[k]) {
          ++psum[cur];
          --psum[min(m + 1, cur + y[k])];
        }
      } else {
        for (int j = x[k]; j <= x[k] + y[k] - 1; ++j) {
          ++tmp[x[k] + y[k]][(i + j) % (x[k] + y[k])];
        }
      }
      last[k] = i;
    } else {
      if (y[k] + x[k] > B) {
        for (int cur = last[k] + x[k]; cur <= m; cur += x[k] + y[k]) {
          if (cur + y[k] < i) {
            continue;
          }
          --psum[max(cur, i)];
          ++psum[min(m + 1, cur + y[k])];
        }
      } else {
        for (int j = x[k]; j <= x[k] + y[k] - 1; ++j) {
          --tmp[x[k] + y[k]][(last[k] + j) % (x[k] + y[k])];
        }
      }
    }
    psum[i] += psum[i - 1];
    int ans = psum[i];
    for (int j = 1; j <= B; ++j) {
      ans += tmp[j][i % j];
    }
    cout << ans << "\n";
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

Kawasiro Nitori is excellent in engineering. Thus she has been appointed to help maintain trains.

There are n models of trains, and Nitori's department will only have at most one train of each model at any moment. In the beginning, there are no trains, at each of the following m days, one train will be added, or one train will be removed. When a train of model i is added at day t, it works for x_i days (day t inclusive), then it is in maintenance for y_i days, then in work for x_i days again, and so on until it is removed.

In order to make management easier, Nitori wants you to help her calculate how many trains are in maintenance in each day.

On a day a train is removed, it is not counted as in maintenance.

Input

The first line contains two integers n, m (1 ≤ n,m ≤ 2 ⋅ 10^5).

The i-th of the next n lines contains two integers x_i,y_i (1 ≤ x_i,y_i ≤ 10^9).

Each of the next m lines contains two integers op, k (1 ≤ k ≤ n, op = 1 or op = 2). If op=1, it means this day's a train of model k is added, otherwise the train of model k is removed. It is guaranteed that when a train of model x is added, there is no train of the same model in the department, and when a train of model x is removed, there is such a train in the department.

Output

Print m lines, The i-th of these lines contains one integers, denoting the number of trains in maintenance in the i-th day.

Examples

Input


3 4
10 15
12 10
1 1
1 3
1 1
2 1
2 3


Output


0
1
0
0


Input


5 4
1 1
10000000 100000000
998244353 1
2 1
1 2
1 5
2 5
1 5
1 1


Output


0
0
0
1

Note

Consider the first example:

The first day: Nitori adds a train of model 3. Only a train of model 3 is running and no train is in maintenance.

The second day: Nitori adds a train of model 1. A train of model 1 is running and a train of model 3 is in maintenance.

The third day: Nitori removes a train of model 1. The situation is the same as the first day.

The fourth day: Nitori removes a train of model 3. There are no trains at all.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int _runtimeTerror_() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n + 1), y(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
  }
  vector<int> psum(m + 5), last(n + 1);
  const int B = 500;
  vector<vector<int>> tmp(B + 1, vector<int>(B + 1));
  for (int i = 1; i <= m; ++i) {
    int op, k;
    cin >> op >> k;
    if (op == 1) {
      if (y[k] + x[k] > B) {
        for (int cur = i + x[k]; cur <= m; cur += x[k] + y[k]) {
          ++psum[cur];
          --psum[min(m + 1, cur + y[k])];
        }
      } else {
        for (int j = x[k]; j <= x[k] + y[k] - 1; ++j) {
          ++tmp[x[k] + y[k]][(i + j) % (x[k] + y[k])];
        }
      }
      last[k] = i;
    } else {
      if (y[k] + x[k] > B) {
        for (int cur = last[k] + x[k]; cur <= m; cur += x[k] + y[k]) {
          if (cur + y[k] < i) {
            continue;
          }
          --psum[max(cur, i)];
          ++psum[min(m + 1, cur + y[k])];
        }
      } else {
        for (int j = x[k]; j <= x[k] + y[k] - 1; ++j) {
          --tmp[x[k] + y[k]][(last[k] + j) % (x[k] + y[k])];
        }
      }
    }
    psum[i] += psum[i - 1];
    int ans = psum[i];
    for (int j = 1; j <= B; ++j) {
      ans += tmp[j][i % j];
    }
    cout << ans << "\n";
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}

```