#include <stdio.h>

int* init_card(int* card, int len) {
  int i;
  for(i=0;i<len;i++) card[len-i-1]=i+1;
  return card;
}

void cut_card(int* card, int p, int c) {
  int diff_card[50], i;

  for(i=0;i<c;    i++) diff_card[i]   = card[p-1+i];
  for(i=0;i<p;    i++) diff_card[i+c] = card[i];
  for(i=0;i<p+c-1;i++) card[i] = diff_card[i];
}

int main() {
  int n,r,card[50];
  
  while(1) {
    scanf("%d %d", &n, &r);
    if(n==0) break;

    init_card(card, n);

    int i,p,c;
    for(i=0;i<r;i++) {
      scanf("%d %d", &p, &c);
      cut_card(card, p, c);
    }
    
    printf("%d\n", card[0]);
  }

  return 0;
}