description: 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.
solution: import java.util.*;
  import java.io.*;
  
  public class Main {
      public static void main(String args[]) {new Main().run();}
  
      FastReader in = new FastReader();
      PrintWriter out = new PrintWriter(System.out);
      void run() {
          work();
          out.flush();
      }
      long mod=1000000007;
      long gcd(long a,long b) {
          return a==0?b:gcd(b%a,a);
      }
      long inf=Long.MAX_VALUE/3;
      void work() {
          int n=ni(),m=ni();
          int[][] A=new int[n][2];
          for(int i=0;i<n;i++){
              A[i]=nia(2);
          }
          int[] B=new int[m];
          int len=(int)Math.sqrt(m);
          int[][] D=new int[len+1][len+1];
          int cur=0;
          int[] pre=new int[n];
          for(int i=0;i<m;i++){
              int type=ni();
              int idx=ni()-1;
              int sum=A[idx][0]+A[idx][1];
              if(type==1){
                  cur+=B[i];
                  for(int j=2;j<=len;j++){
                      cur+=D[j][i%j];
                  }
                  if(sum>len){
                      for(int j=i;j<m;j+=sum){
                          if(j+A[idx][0]<m)B[j+A[idx][0]]++;
                          if(j+sum<m)B[j+sum]--;
                      }
                  }else{
                      int r=i%sum;
                      D[sum][(r+A[idx][0])%sum]++;
                      D[sum][r]--;
                  }
                  pre[idx]=i;
              }else{
                  cur+=B[i];
                  for(int j=2;j<=len;j++){
                      cur+=D[j][i%j];
                  }
                  if(sum>len){
                      for(int j=pre[idx];j<m;j+=sum){
                          if(j+A[idx][0]<m)B[j+A[idx][0]]--;
                          if(j+A[idx][0]<=i&&j+sum>i)cur--;
                          if(j+sum<m)B[j+sum]++;
                      }
                  }else{
                      int r=pre[idx]%sum;
                      D[sum][(r+A[idx][0])%sum]--;
                      D[sum][r]++;
                      int r2=i%sum;
                      if((r+A[idx][0])%sum<r){
                          if(r2>=(r+A[idx][0])%sum&&r2<r){
                              cur--;
                          }
                      }else{
                          if(r2>=(r+A[idx][0])%sum||r2<r){
                              cur--;
                          }
                      }
                  }
              }
              out.println(cur);
          }
      }
  
  
      @SuppressWarnings("unused")
      private ArrayList<Integer>[] ng(int n, int m) {
          ArrayList<Integer>[] graph=(ArrayList<Integer>[])new ArrayList[n];
          for(int i=0;i<n;i++) {
              graph[i]=new ArrayList<>();
          }
          for(int i=1;i<=m;i++) {
              int s=in.nextInt()-1,e=in.nextInt()-1;
              graph[s].add(e);
              graph[e].add(s);
          }
          return graph;
      }
  
      private ArrayList<long[]>[] ngw(int n, int m) {
          ArrayList<long[]>[] graph=(ArrayList<long[]>[])new ArrayList[n];
          for(int i=0;i<n;i++) {
              graph[i]=new ArrayList<>();
          }
          for(int i=1;i<=m;i++) {
              long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();
              graph[(int)s].add(new long[] {e,w});
              graph[(int)e].add(new long[] {s,w});
          }
          return graph;
      }
  
      private int ni() {
          return in.nextInt();
      }
  
      private long nl() {
          return in.nextLong();
      }
      private double nd() {
          return in.nextDouble();
      }
      private String ns() {
          return in.next();
      }
  
      private long[] na(int n) {
          long[] A=new long[n];
          for(int i=0;i<n;i++) {
              A[i]=in.nextLong();
          }
          return A;
      }
  
      private int[] nia(int n) {
          int[] A=new int[n];
          for(int i=0;i<n;i++) {
              A[i]=in.nextInt();
          }
          return A;
      }
  }
  
  class FastReader
  {
      BufferedReader br;
      StringTokenizer st;
      InputStreamReader input;//no buffer
      public FastReader()
      {
          br=new BufferedReader(new InputStreamReader(System.in));
      }
  
      public FastReader(boolean isBuffer)
      {
          if(!isBuffer){
              input=new InputStreamReader(System.in);
          }else{
              br=new BufferedReader(new InputStreamReader(System.in));
          }
      }
  
      public boolean hasNext(){
          try{
              String s=br.readLine();
              if(s==null){
                  return  false;
              }
              st=new StringTokenizer(s);
          }catch(IOException e){
              e.printStackTrace();
          }
          return true;
      }
  
      public String next()
      {
          if(input!=null){
              try {
                  StringBuilder sb=new StringBuilder();
                  int ch=input.read();
                  while(ch=='\n'||ch=='\r'||ch==32){
                      ch=input.read();
                  }
                  while(ch!='\n'&&ch!='\r'&&ch!=32){
                      sb.append((char)ch);
                      ch=input.read();
                  }
                  return sb.toString();
              }catch (Exception e){
                  e.printStackTrace();
              }
          }
          while(st==null || !st.hasMoreElements())//回车，空行情况
          {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
  
      public int nextInt()
      {
          return (int)nextLong();
      }
  
      public long nextLong() {
          try {
              if(input!=null){
                  long ret=0;
                  int b=input.read();
                  while(b<'0'||b>'9'){
                      b=input.read();
                  }
                  while(b>='0'&&b<='9'){
                      ret=ret*10+(b-'0');
                      b=input.read();
                  }
                  return ret;
              }
          }catch (Exception e){
              e.printStackTrace();
          }
          return Long.parseLong(next());
      }
  
      public double nextDouble()
      {
          return Double.parseDouble(next());
      }
  }