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

#define MAX_N 50

int main() {
	int n, r;
	int card[MAX_N];
	int buffer[MAX_N];
	int i, j;

	while(scanf("%d %d", &n, &r) == 2 && n) {
		for(i = 0; i < n; ++i) {
			card[i] = n - i;
		}

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

			memcpy(buffer + c, card, sizeof(int) * p);
			memcpy(buffer, card + p, sizeof(int) * c);
			memcpy(card, buffer, sizeof(int) * (p + c));
		}

		printf("%d\n", card[0]);
	}

	return EXIT_SUCCESS;
}