#include<stdio.h>

int main(void)
{
  int n,r;
  int p = 0;
  int c = 0;

  int a[50] = {0};
  int b[50] = {0};
  int i,j,k;
  
  while(1){
    scanf("%d %d",&n,&r);
    if(n == 0 &&r == 0)
      break;
    
    for(i = 0;i < n;i++){
      a[i] = n - i;
    }
    
    for(j = 0;j < r;j++){
      scanf("%d %d",&p,&c);
      for(k = 0;k < c;k++){
	b[k] = a[p-1+k];
      }
      
      for(k = 0;k < p-1;k++){
	b[c+k] = a[k];
      }
      for(k = 0;k < n-p-c+1;k++){
	b[p+c+j-1]= a[p+c+j-1];
      }

      for(i = 0;i < n;i++){
	a[i] = b[i]; 
      }
    }
    
    printf("%d\n",a[0]);
  }
  
  return 0;
}

  
  