#include <stdio.h>

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