#include <stdio.h>
int main(){
  int card[50][50],n,r;
  int c,p;
  int i,j;
  int count,count2,count3;
  int n2,k,t,h;

  while(1){
    scanf("%d%d",&n,&r);
    if(n==0&&r==0)break;
    
    for(i=0;i<n;i++){
      card[0][i]=i+1;
    }
    
    for(j=0;j<r;j++){
      scanf("%d%d",&p,&c);
      n2=n;
      count=0;
      k=1;
      while(count<c){
	card[j+1][n2-k]=card[j][n2-p];
	count++;
	n2--;
	p++;
	k++;
      }
      t=c;
      k=1;
      count2=0;
      while(count2<p-1){
	card[j+1][n2-1-t]=card[j][n2-k];
	t++;
	k++;
	count2++;
      }
      h=1;
      count3=0;
      while(count3<n-1-(p-1+c)){
	card[j+1][n2-1-(p-h+c)]=card[j][n2-1-(p-h+c)];
	h++;
	count3++;
      }
      
    }
   printf("%d\n",card[r][n-1]); 
}

  return 0;
  }
      
	
      
      