#include <stdio.h>

int stack1[ 50 ], stack2[ 49 ], stack3[ 50 ];
int sp1, sp2 = 0, sp3 = 0;

int main( void ) {
	int n, r, p, c;

	for ( sp1 = 0; scanf( "%d %d", &n, &r ), n; printf( "%d\n", stack1[ sp1 - 1 ] ) ) {
		while ( n-- )
			stack1[ sp1 ] = sp1 + 1, sp1++;

		while ( r-- ) {
			scanf( "%d %d", &p, &c );

			while ( p-- - 1 )
				stack2[ sp2++ ] = stack1[ --sp1 ];

			while ( c-- )
				stack3[ sp3++ ] = stack1[ --sp1 ];

			while ( sp2 )
				stack1[ sp1++ ] = stack2[ --sp2 ];

			while ( sp3 )
				stack1[ sp1++ ] = stack3[ --sp3 ];
		}
	}

	return 0;
}