#include<stdio.h>
int main(void){
	int p, c, count, n, r, huda[200] = {0}, i, j,an[100],a=0;
	while (1) {
		scanf("%d %d", &n, &r);
		for (i = 0;i < n;i++) {
			huda[i] = i + 1;
		}
		if (n == 0 && r == 0) {
			break;
		}
		for (i = 0;i < r;i++) {
			scanf("%d %d", &p, &c);

			for (j = 0;j < c;j++) {
				huda[n + j] = huda[n - p];
				huda[n - p] = -1;
			}

			count = 0;
			for (j = 0;j < n;j++) {

				if (count > n)
					break;
				huda[j] = huda[count];
				if (huda[count] == -1) {
					j--;
				}
				count++;

			}
		/*	for (j = 0;j < n;j++) {
				printf("%d ", huda[j]);
			}*/
		}
		an[a] = huda[n - 1];
		a++;
	}
	for (i = 0;i < a;i++) {
		printf("%d\n", an[i]);
	}

	return 0;
}