#include<stdio.h>
int main(){
    int i, r, x, tmp, n, p, c, z, data[51];
    for(; scanf("%d%d", &n, &r);){
       if( n == 0 && r == 0 ){
           break;
       }
        for( i = n, x = 0; i > 0; i--, x++ ){
            data[x] = i;
        }
        for( i = 0; i < r; i++ ){
            scanf("%d%d", &p, &c);
            for( x = 0; x < p - 1; x++ ){
                for( z = 0; z < p + c-1; z++ ){
                     if( z == 0 ){
                         tmp = data[z];
                     }else if( z == p + c - 2 ){
                        data[z - 1] = data[z];
                        data[z] = tmp;
                     }else{
                        data[z - 1] = data[z];
                     }
                }
            }
        }
        printf("%d\n", data[0]);
    }
    return 0;
}