#include <stdio.h>
int main(){
    while (1){
        int n, r, cards[51], i, k;
        scanf("%d %d", &n, &r);
        if (n == 0)
            return 0;
        for (i=0; i<n; i++)
            cards[i] = n-i;
        for(k = 0; k < r; k++){
            int p, c, tmp[50];
            scanf("%d %d", &p, &c);
            for (i=0; i<c; i++)
                tmp[i] = cards[p+i-1];
            for (; i<c+p-1; i++)
                tmp[i] = cards[i-c];
            for (i = 0; i < c + p - 1; i++)
                cards[i] = tmp[i];
        }
        printf("%d\n", cards[0]);
    }
}