import std.algorithm;
import std.array;
import std.stdio;
import std.conv;
import std.string;
import std.range;

void main(){
    int[] ary;
    int[] temp1, temp2;
    while(true){
        auto input = readln.split;
        int n = input[0].to!int;
        int r = input[1].to!int;
        if(n == 0 && r == 0){
            break;
        }
        ary = iota(1, n + 1).retro.array;
        temp1 = new int[n];
        temp2 = new int[n];
        foreach(i; 0..r){
            auto input2 = readln.split;
            int p = input2[0].to!int;
            int c = input2[1].to!int;
            temp1[0..(p-1)] = ary[0..(p-1)];
            temp2[0..c] = ary[(p-1)..(p-1) + c];
            ary[c..c + (p-1)] = temp1[0..(p-1)];
            ary[0..c] = temp2[0..c];
        }
        ary[0].writeln;
    }
}