#include <stdio.h>

void shuffle(int *card,int p,int c) {
    int backup[50],i;

    for(i = 0; i < c; i++){
	backup[i] = card[p + i];
    }
    for(i = 0; i < p; i++){
	card[p - 1 + c - i] = card[p - 1 - i];
    }
    for(i = 0; i < c; i++){
	card[i + 1] = backup[i];
    }
}

int main(void) {
    int i,n,r,p,c;
    int card[51];

    while (1){
	scanf("%d%d",&n,&r);
	if (n == 0)
	    break;
	for (i = 1;i <= n; i++) {
	    card[i] = n - i + 1;
	}
	for (i = 0;i < r; i++){
	    scanf("%d%d", &p, &c);
	    shuffle(card, p, c);
	}
	printf("%d\n",card[1]);
    }
    return 0;
}