#include <stdio.h>


int suf(int n,int r)
{

  int tow[n],i,j,k,p,c,x;

  for(i=0;i<n;i++){
    tow[i]=n-i;
    printf("tow[%d]=%d\n", i,tow[i]);
  }
  for(i=0;i<r;i++){
    scanf("%d %d", &p,&c);
    for(j=1;j<=c;j++){
      x=tow[p+c-2];
      for(k=1;k<p+c-1;k++)
	tow[p-k+c-1]=tow[p-k+c-2];
      tow[0]=x;
    }
  }

  return(tow[0]);
}

int main(void)
{

  int n,r,out;

  while(1){
    scanf("%d %d", &n,&r);
    if(n==0&&r==0)break;
    out=suf(n,r);
    printf("%d\n", out);
  }
  return 0;
}