// Aizu 1129: Hanafuda Shuffle
// 2017.9.13 bal4u@uu

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

char card[2][53];

int main()
{
	int n, r, p, c, i, k1, k2;
	
	while (scanf("%d%d", &n, &r) && n) {
		for (i = 1; i <= n; i++) card[0][n-i] = i;
		for (k1 = 0, k2 = 1, i = 0; i < r; i++, k1 = k2, k2 = !k2) {
			scanf("%d%d", &p, &c);
			memcpy(card[k2], card[k1], n);
			memcpy(card[k2], card[k1]+p-1, c);
			memcpy(card[k2]+c, card[k1], p-1);
		}
		printf("%d\n", card[k1][0]);
	}
	return 0;
}