#include <iostream>
using namespace std;
int main()
{
    int n,r,p,c;
    int card[100],temp[100];
    
    while(cin >> n >> r,n!=0&&r!=0){
        for(int i=0;i<n;i++) card[i] = n-i;
        for(int i=0;i<r;i++){
            cin >> p >> c;
            for(int i=0;i<c;i++) temp[i] = card[p-1+i];
            for(int i=0;i<p-1;i++) temp[i+c] = card[i];
            for(int i=0;i<p+c-1;i++) card[i] = temp[i];
        }
        cout << card[0] << endl;
    }

    return(0);
}

