#include <stdio.h>

int main() {
    while (1) {
        int n, r, Cards[51], tmp[51], i;
        scanf("%d %d", &n, &r);

        if ( n == 0 && r == 0) { break; }

        for (i = 0; i < n; i++) { Cards[i] = n-i; }

        while (r--) {
            int p, c;
            scanf("%d %d", &p, &c);
            for (i = 0; i < c; i++) {
                tmp[i] = Cards[p+i-1];
            }
            for (i = c; i < p+c-1; i++) {
                tmp[i] = Cards[i-c];
            }
            for (i = p+c-1; i < n; i++) {
                tmp[i] = Cards[i];
            }
            for (i = 0; i < n; i++) { Cards[i] = tmp[i]; }
        }
        printf("%d\n", Cards[0]);
    }

    return 0;
}
