#include<stdio.h>

int main(){
	int before[51],after[51],n,r,p,c,i,j;
	
	while(0<=scanf("%d%d",&n,&r)){
		
		if(n==0 && r==0){
			break;
		}
		for(i=0;i<=50;i++){
			before[i]=i;
			after[i]=i;
		}
		
		for(j=0;j<r;j++){
			scanf("%d%d",&p,&c);
			//shita to ue
			for(i=n-c-p+2;i<=n-p+1;i++){
				after[i+p-1]=before[i];
			}
			//ue to shita
			for(i=n-c+2-p;i<=n-c;i++){
				after[i]=before[i+c];
			}
			
			for(i=1;i<=n;i++){
				before[i]=after[i];
			}
			
			// for(i=1;i<=n;i++){
				// printf("%d ",before[i]);
			// }
			// printf("\n%d %d\n",p,c);
			

		}
		printf("%d\n",after[n]);
	}
	return 0;
}