#include <stdio.h>

int stack[50];
int temp[50];

int main(void){
    int n,r,i,j;
    while(scanf("%d %d",&n, &r),n||r){
        for(i=0;i<n;i++){//stack[0]:?????????(n) stack[n-1]:?????????(1)
            stack[i]=n-i;
        }
        for(i=0;i<r;i++){
            int p,c;
            scanf("%d %d", &p, &c);
            for(j=0;j<c;j++){//?????????p????????????c??????temp????§????
                temp[j]=stack[p-1+j];
            }
            for(j=p-2;j>=0;j--){//?????????p-1??????c??????????§????
                stack[j+c]=stack[j];
            }
            for(j=0;j<c;j++){//temp??????c?????????????±±??????????§????
                stack[j]=temp[j];
            }
        }
        printf("%d\n", stack[0]);
    }
    return 0;
}