#include <stdio.h>
#include <string.h>

int main(void)
{
    int n, r;

    while (scanf("%d %d", &n, &r), n){
        int card[64];
        int i;

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

        while (r-- > 0){
            int p, c;
            int tmp[64];

            scanf("%d %d", &p, &c);
            for (i = p - 1; i < p + c; i++){
                tmp[i - p + 1] = card[i];
            }
            for (i = p + c - 1; i > c - 1; i--){
                card[i] = card[i - c];
            }
            for (i = 0; i < c; i++){
                card[i] = tmp[i];
            }
        }

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

    return 0;
}