using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sc = Scanner;

class Program
{
    static void Main(string[] args)
    {
        int[] hanahuda = new int[50];
        int[] tmp = new int[50];
        var q = new AnswerCollecter<int>();

        while (true)
        {
            int n = sc.NextInt();
            int r = sc.NextInt();
            if (n == 0) break;
            for (int i = 1; i < 51; i++)
            {
                hanahuda[i - 1] = i;
            }
            for (int i = 0; i < r; i++)
            {
                int p = sc.NextInt();
                int c = sc.NextInt();
                for (int j = 0; j < c; j++)
                {
                    tmp[j] = hanahuda[n  - p - c + 1+ j];
                }
                for (int j = n-p-c+1; j+c < n; j++)
                {

                    hanahuda[j] = hanahuda[j+c];
                }
                for (int j = 0; j < c; j++)
                {
                    hanahuda[j + n - c] = tmp[j];
                }
            }
            q.Enqueue(hanahuda[n-1]);
        }
        q.Answer();
    }
}

public class AnswerCollecter<T>
{
    private Queue<T> q;

    public AnswerCollecter()
    {
        q = new Queue<T>();
    }

    public void Enqueue( T item)
    {
        q.Enqueue(item);
    }

    public void Answer()
    {
        while (q.Count != 0)
            Console.WriteLine(q.Dequeue());
    }
}
   
public static class Scanner
{
    public static string[] NextStrArray()
    {
        return Console.ReadLine().Split(' ');
    }

    public static long[] NextLongArray()
    {
        string[] s = NextStrArray();
        long[] a = new long[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = long.Parse(s[i]);
        }
        return a;
    }
    public static int[] NextIntArray()
    {

        string[] s = NextStrArray();
        int[] a = new int[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = int.Parse(s[i]);
        }
        return a;
    }
    public static int NextInt()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
        
            tmp += readData;
        }
        return int.Parse(tmp);
    }
    public static double NextDouble()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
            tmp += readData;
        }
        return double.Parse(tmp);
    }
    public static long NextLong()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
            tmp += readData;
        }
        return long.Parse(tmp);
    }
    public static double[] NextDoubleArray()
    {

        string[] s = NextStrArray();
        double[] a = new double[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = double.Parse(s[i]);
        }
        return a;
    }
}

Measured memory_bytes: 6020