#include <stdio.h>

int main(void)
{
    while(1){
        int n, r, p, c;
        scanf("%d %d", &n, &r);
        if(n == 0 && r == 0)
            break;
        int deck[51];
        int i;
        for(i = 1; i <= n; i++)
            deck[i] = i;

        for(i = 0; i < r; i++){
            scanf("%d %d", &p, &c);
            int j;
            int temp[51];
            for(j = 1; j <= n; j++)
                temp[j] = deck[j];
            for(j = n; j > n - p + 1; j--)
                deck[j - c] = temp[j];
            for(j = n - p + 1; j > n - (p - 1 + c); j--)
                deck[j + p - 1] = temp[j];
        }

        printf("%d\n", deck[n]);
    }

    return 0;
}