#include <algorithm>
#include <iostream>
using namespace std;
int N,R,p,c;
int A[50] = {};
int main(void) {
	while (cin >> N >> R && N) {
		for (int i=0; i<N; ++i) A[i] = N-i;
		for (int i=0; i<R; ++i) {
			cin >> p >> c;
			rotate (A,A+p-1,A+p+c-1);
		}
		cout << A[0] << endl;
	}
}