#include <stdio.h>
#include <string.h>

int main(void)
{
	int n, r;
	int p, c;
	int card[50], card_next[50];
	int i, j, a;
	
	
	while (1){
		scanf("%d%d", &n, &r);
		if (n == 0 && r == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			card[i] = i + 1;
		}
		
		for (i = 0; i < r; i++){
			scanf("%d%d", &p, &c);

			a = 0;
			for (j = 0; j < n - (p - 1) - c; j++){
				card_next[a++] = card[j];
//printf("<%d>", j);
			}
			for (j = n - p + 1; j < n; j++){
				card_next[a++] = card[j];
//printf("[%d]", j);
			}
			for (j = n - (p - 1) - c; j < n - (p - 1); j++){
				card_next[a++] = card[j];
//printf("(%d)", j);
			}
			memcpy(card, card_next, sizeof(card));
		}
		printf("%d\n", card[n - 1]);
	}
	return (0);
}
	