#include <stdio.h>

int main(void){
	int n, r, p, c, i, j, z, hanahuda[50], buf;

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

		for (i = 0; i < n; i++){
			hanahuda[i] = i + 1;
		}

		for (i = 0; i < r; i++){
			scanf("%d %d", &p, &c);
			if (p != 1){
				for (j = n - p - c + 1; j <= n - p; j++){
					buf = hanahuda[0];
					for (z = 0; z < n - 1; z++){
						hanahuda[z] = hanahuda[z + 1];
					}
					hanahuda[n - 1] = buf;
				}
			}
		}
		printf("%d\n", hanahuda[n - 1]);
	}

	return 0;
}