#include <array>
#include <iostream>
#include <algorithm>
using namespace std;

int N,R,p,c;
int main() {
  while (cin >> N >> R && N) {
  array<int,50> A = {};
  for (int i=0;i<N;i++) {
    A[i] = N-i;
  }
  /*  for (int i=0;i<N;i++) {
    cout << A[i];
  }
  cout << endl; */
  for (int i=0;i<R;i++) {
    cin >> p >> c;
    rotate(A.begin(),A.begin()+p-1,A.begin()+p-1+c);
    /*    for (int i=0;i<N;i++) {
      cout << A[i];
    }
    cout << endl; */
  }
  cout << A[0] << endl;
}
}