#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;

			for(j = 0; j < c; ++j) {
				buffer[j] = card[p + j];
			}

			for(j = 0; j < p; ++j) {
				buffer[j + c] = card[j];
			}

			for(j = p + c; j < n; ++j) {
				buffer[j] = card[j];
			}

			memcpy(card, buffer, sizeof(card));
		}

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

	return EXIT_SUCCESS;
}