#include<stdio.h>
int main(void){
	int n,r;
	int p,c;
	int i,j;
	int k = 0;
	int card[50],tmp[50];
	while(scanf("%d %d",&n,&r)){
		if(n == 0 && r == 0){
			break;
		}
		for(i = 0;i < n;i++){
			card[i] = n - i;
		}
		for(i = 0;i < r;i++){
			scanf("%d %d",&p,&c);
			for(j = 0;j < c;j++){
				tmp[k] = card[p - 1 + j];
				k++;
			}
			for(j = 0;j < p - 1;j++){
				tmp[k] = card[j];
				k++;
			}
			for(j = 0;j < p + c - 1;j++){
				card[j] = tmp[j];
			}
			k = 0;
		}
		printf("%d\n",card[0]);
	}
	return 0;
}