#include<stdio.h>
main(){
  int n,r,i,k,p,c,cards[50],cards2[50],j;
  while(1){
  scanf("%d %d",&n,&r);
  if(n==0&&r==0)break;
  for(i=n-1,j=1;i>=0;i--,j++)cards[i]=j;
  for(i=0;i<r;i++){
    scanf("%d %d",&p,&c);
    for(j=0;j<p-1;j++)cards2[j]=cards[j];
    for(j=p-1,k=0;j<c+p-1;j++,k++)cards[k]=cards[j];
    for(j=c,k=0;j<c+p-1;j++,k++)cards[j]=cards2[k];
  }
  printf("%d\n",cards[0]);
  }
  return 0;
}