#include<stdio.h>
#define M 60

int main(void){
  int i,j;
  int n,r;
  int p,c;
  int hnfd[M],swp[M];

  for(;;){
    scanf("%d%d",&n,&r);
    if(n==0 && r==0) break;

    for(i=0;i<n;i++) hnfd[i]=i+1;

    for(i=0;i<r;i++){
      scanf("%d%d",&p,&c);

      for(j=0;j<=n-p-c;j++) swp[j]=hnfd[j];

      for(j=0;j<c;j++) swp[n-1-j]=hnfd[n-p-j];

      for(j=1;j<p;j++) swp[n-c-j]=hnfd[n-j];

      for(j=0;j<n;j++) hnfd[j]=swp[j];
    }
    printf("%d\n",hnfd[n-1]);
  }
  return 0;
}