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

int main() {
    int n, r, p, c;
    while (cin >> n >> r, n | r) {
        vector<int> deck;
        for (int i = n; i > 0; i--) deck.push_back(i);
        while (r--) {
            cin >> p >> c;
            rotate(deck.begin(), deck.begin() + p - 1, deck.begin() + p - 1 + c);
        }
        cout << deck[0] << endl;
    }
    return 0;
}