#include<stdio.h>
#define N 50
int main(void)

{
  int g,n=1,r=1,p,c,i,j,card[N],save[N];
  while(1){
    scanf("%d%d",&n,&r);
    if(n == 0 && r == 0)
      break;
    g = n;
    for(i = 0;i < n;i++){
      card[i]= g;
      g--;
    }
    for(i = 0;i < r;i++){
      scanf("%d%d",&p,&c);
      g =0;
      for(j = 0;j < p-1;j++){
        save[j] = card[j];
      }
      for(j = 0;j < c;j++){
        card[j] = card[p-1+j];
      }
      for(j = 0;j < p-1 ;j++){
        card[c+j] = save[j];
      }
    }
    printf("%d\n",card[0]);
  }
  return 0;
}