#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int Arr[50] = {0};

void arr_output(void)  {
  int k;
  for ( k = 0; k < 50; k++ ){
    printf("%d ", Arr[k]);
  }
  puts("");
}

void arr_init(int n) {
  int k;
  for ( k = 0; k < n; k++  ) {
    Arr[k] = n - k;
  }

}

void shuffle(int n, int start, int num) {
  int k1, k2;
  int m = 0;
  int swap[50] = {0};
  int end = start+num;

  for ( k1 = start; k1 < end; k1++ ){
    swap[m] = Arr[k1];
    m++;
  }

  m = end-1;

  for ( k1 = start-1; k1 >= 0; k1-- ) {
    Arr[m] = Arr[k1];
    m--;
  }


  for ( k1 = 0; k1 < num; k1++ ){
    Arr[k1] = swap[k1];
  }
}

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

  while ( 1 ) {
    scanf("%d %d", &n, &r);

    arr_init(n);

    if ( !n && !r ) { break; }

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

      shuffle (n, p-1, c);
    }
    printf("%d\n", Arr[0]);

  }

  return 0;
}