#define MAX 50
#include <stdio.h>

void set_card(int *card,int n){
    int i;
    for(i=0;i<n;i++){
        card[i] = i+1;
    }
}

void copy_card(int *card,int *copy, int n){
    int i;
    for(i=0;i<n;i++){
        copy[i] = card[i];
    }
}
void shuffle_card(int *card, int *copy,int n,int p,int c){
    int i;
    for(i=0;i<p-1;i++){
        card[n-c-i-1] = copy[n-i-1];
    }
    for(i=0;i<c;i++){
        card[n-i-1] = copy[n-p-i];
    }
    
}
int main(void) {
    int n,r,p,c;
    int card[MAX] = {};
    int copy[MAX] = {};

    int i;
    
    while(1){
        scanf("%d%d",&n,&r);
        if(n==0 && r==0)
            break;
        set_card(card,n);
        copy_card(card,copy,n);
    
        for(i=0;i<r;i++){
            scanf("%d%d",&p,&c);
            shuffle_card(card,copy,n,p,c);
            copy_card(card,copy,n);
        }
        printf("%d\n", card[n-1]);
    }
    return 0;
    
    }