/* be careful of cases "p=1" */

#include <stdio.h>
#define N_MAX (50+1)

/* ---------------------------------------------------------------------------- */

/* if no cards exist under the card "N", list[N] = 0.
 * otherwise, list[N] is value of the card just under "N".
 * list[0] indicates value of the card on the top of deck */
int next[N_MAX];

void init(int n)
{
    int i;

    /* the top card is "n" */
    next[0] = n;

    /* the card just under "i" is "i-1" */
    for(i=1; i<=n; i++) next[i] = i-1;
}

void cut(int p, int c)
{
    int p_lst, c_fst, c_lst, rest, i;

    /* search for key cards */

    /* +-------+
     * |  NULL |
     * +-------+
     * |  ...  | <--+
     * | p_lst |    |
     * +-------+    |
     * | c_fst |    |
     * |  ...  | <--+
     * | c_lst |
     * +-------+
     * |  rest |
     * |  ...  | */

    p_lst = 0;
    for(i=0; i<p-1; i++) p_lst = next[p_lst];

    c_lst = c_fst = next[p_lst];
    for(i=0; i<c-1; i++) c_lst = next[c_lst];

    rest = next[c_lst];

    /* exchange */

    next[p_lst] = rest;
    next[c_lst] = next[0];
    next[0] = c_fst;
}

int main(void)
{
    int n, r, p, c;

    while(scanf("%d %d", &n, &r), n + r)
    {
        init(n);

        while(r--)
        {
            scanf("%d %d", &p, &c);
            cut(p, c);
        }

        printf("%d\n", next[0]);
    }

    return 0;
}