#include <stdio.h>

int main() {
  int n, r, p, c;
  int cards[50], temp[50];
  int i, j;

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

    for(i = 0; i < 50; i++) {
      cards[i] = i + 1;
    }
    for(i = 0; i < r; i++) {
      scanf("%d %d", &p, &c);
      for(j = 0; j < c; j++) {
	temp[j] = cards[n - (c + p - 1) + j];
      }
      for(j = 0; j < p - 1; j++) {
	cards[n - (c + p - 1) + j] = cards[n - (p - 1) + j];
      }
      for(j = 0; j < c; j++) {
	cards[n - c + j] = temp[j];
      }
    }
    printf("%d\n", cards[n-1]);
  }
  return 0;
}