#include <stdio.h>
	int yama[50];
	
void maze(int c,int d){
	int kara[50];
	int h;
	for(h = 0;h < c;h++){
		kara[h] = yama[h];
	}
	for(h = 0;h < d;h++){
		yama[h] = yama[h + c];
	}
	for(h = 0;h < c;h++){
		yama[h + d] = kara[h];
		
		
	}
	
}

int main(void)
{
	int a,b;
	int c,d;
	int i,j = 0,q = 0;
	int ans[50];
	while(1){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0)break;
		j = 1;
		for(i = a - 1;i >= 0;i--){
			yama[i] = j;
			j++;
		}
		
		for(i = 0;i < b;i++){
			scanf("%d %d",&c,&d);
			maze(c-1,d);
		}
		printf("%d\n",yama[0]);

	}

	return 0;
}