#include<stdio.h>

int card[50];

void change_card(int n, int p, int c){
  int tmp[50];
  int i,j;

  //c?????????????????????tmp????????????
  for(i=0;i<=50;i++){
    tmp[i]=0;
  }


  //tmp???C????????¨??????????????£??\
  for(i=1;i<=c;i++){
    tmp[i]=card[n-p-c+1+i];
    //printf("tmp[%d] = %d\n",i,tmp[i]);
  }

  for(i=1,j=1;j<=c;i++){
    if(i<=p-1){
      card[n-p-c+1+i]=card[n-p+1+i];
      //printf("??°??????%d\n",card[n-p+i]);
      //printf("??°??????card[%d] = %d\n",n-p-c+1+i,card[n-p-c+1+i]);
    }else{
      card[n-p-c+1+i]=tmp[j];
      //printf("card[%d] = %d\n",n-p-c+1+i,tmp[j]);
      j++;
    }
  }
/*
  for(i=1;i<=n;i++){
    printf("card[%d] = %d\n",i,card[i]);
  }
*/
};


int main(){

  int n,r,p,c;
  int i;

  for(;scanf("%d %d",&n,&r),n,r;){
    //?????????????????????
    for(i=0;i<=50;i++){
      card[i]=i;
    }
    for(i=1;i<=r;i++){
      scanf("%d %d",&p,&c);
      change_card(n,p,c);
    }
    printf("%d\n",card[n]);
  }

  return 0;

}