#include <stdio.h>

void shuffle(int a[], int n, int p, int c) {
  int b[50] = {0}, i, j;
  for (i = 0; i < c; i++)
    b[i] = a[i + p - 1];
  for (i = p - 1; i >= 0; i--)
    a[i + c] = a[i];
  for (i = 0; i < c; i++)
    a[i] = b[i];
    
}

int main(void) {
  int a[50], n, r, p, c, i;

  while (1) {
    scanf("%d %d", &n, &r);
    if (n == 0 && r == 0) break;

    for (i = 0; i < n; i++)
      a[i] = n - i;

    while (r--) {
      scanf("%d %d", &p, &c);
      shuffle(a, n, p, c);
    }
    printf("%d\n", a[0]);
  }
  return 0;
}