#include <stdio.h>
#define MAX 50

int main(void)
{
  int n, r, p, c;
  int i, j, k, l, m, temp;
  int card[MAX];
  int blue[MAX];
  int yellow[MAX];
  int firstcard;

  while(1)
    {
      scanf("%d %d",&n,&r);
      if(n==0)
	break;

      j = n;
      for(i=0;i<=n-1;i++)
	{
	  card[i] = j - i;
	}

      /*CHECK BEGIN!!!
      for(i=0;i<=n-1;i++)
	{
	  printf("card[%d] %d\n",i,card[i]);
	}
      CECHK END!!!*/
      
      for(l=0;l<r;l++)
	{
	  scanf("%d %d",&p,&c);

	  if(p!=1)
	    {
	      for(j=0;j<p-1;j++)
		{
		  blue[j] = card[j];
		}
	    }
	  if(c==1)
	    {
	      yellow[0] = card[p-1];
	    }
	  else
	    {
	      for(k=0;k<c;k++)
		{
		  yellow[k] = card[p+k-1];
		}
	    }
	  /*CHECK BEGIN!!
	  if(p!=1)
	    {
	      for(j=0;j<p-1;j++)
		{
		  printf("blue[%d] = %d\n",j,blue[j]);
		}
	    }
	  if(c==1)
	    {
	      printf("yellow[%d] = %d\n",0,yellow[0]);
	    }
	  else
	    {
	      for(k=0;k<c;k++)
		{
		  printf("yellow[%d] = %d\n",k,yellow[k]);
		}
	    }
	  CHECK END!!*/

	  /*????????¨????????\*/
	  if(c==1)
	    {
	      card[0] = yellow[0];
	    }
	  else
	    {
	      for(i=0;i<c;i++)
		{
		  card[i] = yellow[i];
		}
	    }
	  /*????????¨????????\*/
	  if(p==1)
	    {
	    }
	  else
	    {
	      for(j=0;j<p-1;j++)
		{
		  card[c+j] = blue[j];
		}
	    }

	  /*CHECK BEGIN!!!
	  for(i=0;i<=n-1;i++)
	    {
	      printf("card[%d] %d\n",i,card[i]);
	    }
	  CECHK END!!!*/
	}
      printf("%d\n",card[0]);
    }
  return 0;
}