import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    while (true) {
        int n, r;
        scan(n, r);

        if (n == 0 && r == 0) return;

        auto a = iota(1, n + 1).retro.array;

        foreach (i ; 0 .. r) {
            int p, c;
            scan(p, c);
            p--;

            a = a[p .. p + c] ~ a[0 .. p] ~ a[p+c .. $];
        }

        writeln(a[0]);
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}