#include <stdio.h>
#include <stdlib.h>

#define MAX 100



int main(){

	int n,r;
	int p,c;
	int i,j;
	int number[MAX];
	int buffer[MAX];
	int index;

	while(1){

		scanf("%d %d",&n,&r);			

		if(n == 0 && r == 0){
			return 0;
		}

		for(i=0; i<n; i++){
			number[n-i-1] = i+1;
		}

/*
????????????????????????????????§????????????????????¨?????§???
???????????°????????????????????£?????????????????????
*/
		for(i=0; i<r; i++){
			scanf("%d %d",&p,&c);
			index = 0;
			for(j=0; j<c; j++){
				buffer[index] = number[p-1+j];
				index++;
			}
			for(j=0; j<p-1; j++){
				buffer[index] = number[j];
				index++;
			}

			/*????????????????????§????????????????????´?????\?????????????????????????????¨??????i=?§???????index???????????????????????\????????¨??????*/
			for(j=p-1+c; j<n; j++){
				buffer[index] = number[p-1+c+j];
				index++;
			}
			for(j=0; j<n; j++){
				number[j] = buffer[j];
			}
		}
		printf("%d\n",number[0]);

	}
	
}