#include <stdio.h>
??
int main() {
??
????int r,d,n,i,j,k,l;
????int p,c;
????int a[60] = {0};
????int b[60] = {0};
??
??
????while(1) {
??
????????scanf("%d %d", &n, &r);
??
????????if(n == 0 && r == 0) {
????????????break;
????????}
??
??
????????for(i =0 ; i<=n ; i++) {
????????????a[n-1-i] = i+1;
????????????b[n-1-i] = i+1;
????????}
??
??
??
????????for(i = 0; i < r; i++) {
????????????scanf("%d %d",&p,&c);
??
????????????for(j = 0; j<c;j++) {
????????a[j] = b[p+j-1];
????????//printf("a[%d] = %d\n",j,a[j]);
????????????}
????????????for(j = 0;j<p-1;j++) {
????????a[c+j] = b[j];
????????//printf("a[%d] = %d\n" ,c+j ,a[c+j]);
????????????}
??
????????????for(j = 0;j<p+c-1;j++) {
????????b[j] = a[j];
????????????}
????????}
??
??
????????printf("%d\n",a[0]);
??
????}
??
????return 0;
}