#include <stdio.h>

int main()
{
    int card[55] = {};
    int save[55] = {};
    int n, r, p, c;

    scanf("%d", &n);
    while (n != 0) {
        scanf("%d", &r);

        for (int i = 0; i < n; i++) {
            card[i] = n - i;
        }

        for (int i = 0; i < r; i++) {
            scanf("%d %d", &p, &c);

            for (int j = 0; j < n; j++) {
                save[j] = card[j];
            }

            for (int j = 0; j < p - 1; j++) {
                save[j + c] = card[j];
            }

            for (int j = 0; j < c; j++) {
                save[j] = card[j + p - 1];
            }

            for (int j = 0; j < n; j++) {
                card[j] = save[j];
            }

        }

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

        scanf("%d", &n);
    }

    return 0;
}

