#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int n, r;
 int tmp[64];
 int p, c;
    while(1){
      scanf("%d %d", &n, &r);
      if(!n && !r)
      break;
        int card[64];
        int i;
 
        for (i = 0; i < n; i++){
            card[i] = n-i; 
        }
 
        while (r-- > 0){
            //int p, c;
            //int tmp[64];
 
            scanf("%d %d", &p, &c);
            for (i = p - 1; i < p + c - 1; i++){               
                tmp[i - p + 1] = card[i];
            }
            for (i = p - 1 + c - 1; i-c+1 > 0 ; i--){ 
                card[i] = card[i - c];
            }
            int j = 0;
            for (i = 0; i < c; i++){
                card[i] = tmp[j];
                j++;
            }
        }
 
        printf("%d\n", card[0]);
    
    }
    return 0;
}