#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	int n,r;
	int yama[51];
	int stook[51];

	while(1){
		cin>>n>>r;
		if(n==0&&r==0)
			break;
		int p,c;
		
			for(int i=1;i<=n;i++)
				yama[i]=i;
			
		for(int t=0;t<r;t++){
			cin>>p>>c;
			for(int i=1;i<=p-1;i++)
				stook[i]=yama[n-i+1];
	
			for(int i=1;i<=c;i++)
				yama[n-i+1]=yama[n-p+2-i];

			for(int i=1;i<=p-1;i++)
				yama[n-c-i+1]=stook[i];
		}

			cout<<yama[n]<<endl;
	}
	
	return 0;
}