while True:

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



    if n == 0 and r == 0:

        break



    Cards = [i for i in range(n, 0, -1)]



    for i in range(r):

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

        Cards = Cards[p-1:p-1+c] + Cards[:p-1] + Cards[p-1+c:]



    print(Cards[0])

while True:

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



    if n == 0 and r == 0:

        break



    Cards = list(range(n, 0, -1))



    for i in range(r):

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

        Cards = Cards[p-1:p-1+c] + Cards[:p-1] + Cards[p-1+c:]



    print(Cards[0])



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

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

-    Cards = [i for i in range(n, 0, -1)] +    Cards = list(range(n, 0, -1))