while True:

    a=[int(num)for num in input().split(' ')]

    n=a[0]

    if n==0:break

    hanafuda=[i+1 for i in range(n)]

    for i in range(a[1]):

        b=[int(num)for num in input().split(' ')]

        for j in range(b[1]):hanafuda.append(hanafuda.pop(n-(b[0]+b[1])+1))

    print((hanafuda.pop()))
while True:

    n,r=[int(s)for s in input().split(" ")]

    if n==r==0:break

    ops=[[int(s)for s in input().split(" ")]for i in range(r)]

    cd=[n-i for i in range(n)]

    for op in ops:

        p,c=op

        l=cd[p-1:p+c-1]

        del cd[p-1:p+c-1]

        cd=l+cd

    print((cd[0]))
while True:
    a = [int(num) for num in input().split(" ")]
    n = a[0]
    if n == 0:
        break
    hanafuda = [i + 1 for i in range(n)]
    for i in range(a[1]):
        b = [int(num) for num in input().split(" ")]
        for j in range(b[1]):
            hanafuda.append(hanafuda.pop(n - (b[0] + b[1]) + 1))
    print((hanafuda.pop()))

while True:
    n, r = [int(s) for s in input().split(" ")]
    if n == r == 0:
        break
    ops = [[int(s) for s in input().split(" ")] for i in range(r)]
    cd = [n - i for i in range(n)]
    for op in ops:
        p, c = op
        l = cd[p - 1 : p + c - 1]
        del cd[p - 1 : p + c - 1]
        cd = l + cd
    print((cd[0]))

-    a = [int(num) for num in input().split(" ")] -    n = a[0] -    if n == 0: +    n, r = [int(s) for s in input().split(" ")] +    if n == r == 0: -    hanafuda = [i + 1 for i in range(n)] -    for i in range(a[1]): -        b = [int(num) for num in input().split(" ")] -        for j in range(b[1]): -            hanafuda.append(hanafuda.pop(n - (b[0] + b[1]) + 1)) -    print((hanafuda.pop())) +    ops = [[int(s) for s in input().split(" ")] for i in range(r)] +    cd = [n - i for i in range(n)] +    for op in ops: +        p, c = op +        l = cd[p - 1 : p + c - 1] +        del cd[p - 1 : p + c - 1] +        cd = l + cd +    print((cd[0]))