#include <stdio.h>
#define NUM 51

void cut(int n, int p, int c, int cards[]) {
    int array[NUM];
    int i, j;
    for(i = p - 1, j = 0; i < p + c - 1; i++, j++ ) {
        array[j] = cards[i];
        cards[i] = 0;
    }
    for(i = 0; i < n; i++ ) {
        if(cards[i]) {
            array[j] = cards[i];
            j++;
        }
    }
    for(i = 0; i < n; i++ ) {
        cards[i] = array[i];

    }
}


int main(void) {
    int i, j, n, r, p, c;
    int cards[NUM];
    scanf("%d %d",&n,&r);
    while(n){
        for(i = 0; i < n; i++ ) {
            cards[i] = n - i;

        }
        for(i = 0; i < r; i++ ) {
            scanf("%d %d",&p,&c);
            cut(n,p,c,cards);
        }
        printf("%d\n",cards[0]);
        scanf("%d %d",&n,&r);
    }
    return 0;
}