while True:

    n,r = list(map(int,input().split()))

    if(n == 0 and r == 0):

        break

    n_list = []

    for i in range(n):

        n_list.append(i+1)

    for i in range(r):

        p,c = list(map(int, input().split()))

        n_list =  n_list[0:n-(p-1)-c] + n_list[n-(p-1):n] + n_list[n-(p-1)-c:n-(p-1)]

    print(n_list[n-1])
while True:

    n,r = list(map(int,input().split()))

    if(n == 0 and r == 0):

        break

    li = []

    for i in range(1,n+1):

        li.append(i)

    for i in range(r):

        temp_lis1 = []

        p,c = list(map(int,input().split()))

        if(c == 1):

            temp_lis1.append(li[n-p])

            del(li[n-p])

        else:

            temp_lis1.extend(li[n-p-c+1:n-p+1])

            del(li[n-p-c+1:n-p+1])

        li.extend(temp_lis1)

    print(li[n-1])
while True:
    n, r = list(map(int, input().split()))
    if n == 0 and r == 0:
        break
    n_list = []
    for i in range(n):
        n_list.append(i + 1)
    for i in range(r):
        p, c = list(map(int, input().split()))
        n_list = (
            n_list[0 : n - (p - 1) - c]
            + n_list[n - (p - 1) : n]
            + n_list[n - (p - 1) - c : n - (p - 1)]
        )
    print(n_list[n - 1])

while True:
    n, r = list(map(int, input().split()))
    if n == 0 and r == 0:
        break
    li = []
    for i in range(1, n + 1):
        li.append(i)
    for i in range(r):
        temp_lis1 = []
        p, c = list(map(int, input().split()))
        if c == 1:
            temp_lis1.append(li[n - p])
            del li[n - p]
        else:
            temp_lis1.extend(li[n - p - c + 1 : n - p + 1])
            del li[n - p - c + 1 : n - p + 1]
        li.extend(temp_lis1)
    print(li[n - 1])

-    n_list = [] -    for i in range(n): -        n_list.append(i + 1) +    li = [] +    for i in range(1, n + 1): +        li.append(i) +        temp_lis1 = [] -        n_list = ( -            n_list[0 : n - (p - 1) - c] -            + n_list[n - (p - 1) : n] -            + n_list[n - (p - 1) - c : n - (p - 1)] -        ) -    print(n_list[n - 1]) +        if c == 1: +            temp_lis1.append(li[n - p]) +            del li[n - p] +        else: +            temp_lis1.extend(li[n - p - c + 1 : n - p + 1]) +            del li[n - p - c + 1 : n - p + 1] +        li.extend(temp_lis1) +    print(li[n - 1])