#include <stdio.h>
#define N 50


int main(int argc, const char * argv[]) {
    
    int n=0, r=0, p, c, i, j;
    int card[N],tmp[N],tmp2[N];
    
    
while (1) {
    
    
    n=0;r=0;p=0;c=0;i=0;j=0;
    
    for (i = 0; i < N; i++) {
        card[i] = 0;
        tmp[i] = 0;
        tmp2[i] = 0;
    }
    
    
    scanf("%d %d",&n,&r);
    
    
    if (n == 0 && r == 0) {
        break;
    }
    
    //cardnum
    for (i = 0; i < n; i++) {
        card[i] = n-i;
    }
    
    for (i = 0; i < r; i++) {
        
        scanf("%d %d",&p,&c);
        
        //shufflu
        //?????????????????????????????????
        for (j = 0 ; j < c; j++) {
            tmp[j] = card[p-1+j];
        }
        //tmp2
        for (j = 0; j < p-1; j++) {
            tmp2[j] = card[j];
        }
        //irerutmp1
        for (j = 0; j < c; j++) {
            card[j] = tmp[j];
        }
        
        for (j = 0; j < p-1; j++) {
            card[c + j] = tmp2[j];
        }
        
    }
    
    printf("%d\n",card[0]);
    
}
    return 0;
    
}