#include <stdio.h>


int main(void){
	int n,r,p,c,i,j,k;
	
	while(1){
		scanf("%d %d",&n,&r);
		if(n == 0) break;
		int huda[51],pre[51];
		for(i = 0;i < n;i++){
			huda[i] = i;
			pre[i] = i;
		}
		for(j = 0;j < r;j++){
			scanf("%d %d",&p,&c);
			for(k = n - p - c + 1;k < n - c;k++) huda[k] = pre[k + c];
			for(k = n - c;k < n;k++) huda[k] = pre[k - p + 1];
			for(i = 0;i < n;i++) pre[i] = huda[i];
		}
		printf("%d\n",huda[n - 1] + 1);
	}
	return 0;
}
