int main (void){
    int i,j,n,r,p,c;
    int card[100]={0},nc[100]={0};
    while(-1){
        scanf("%d %d",&n,&r);
        if(n==0&&r==0){break;}
        for(i=0;i<n;i++){
            nc[i]=n-i;
        }
        for(i=0;i<r;i++){
            scanf("%d %d",&p,&c);
            for(j=0;j<p-1;j++){
                card[j+c]=nc[j];
            }
            for(j=p-1;j<p+c-1;j++){
                card[j-p+1]=nc[j];
            }
            for(j=p+c-1;j<n;j++){
                card[j]=nc[j];
            }
            for(j=0;j<n;j++){
                nc[j]=card[j];
            }
            
        }
        printf("%d\n",nc[0]);
    }
    return 0;
        
}