#include <stdio.h>
int main()
{
  int i, j, n, r, q, N, R;
  int d[51], sd[51];
  while(1)
    {
      for ( i = 0; i < 51; i++)
	{
	  d[i] = 0;
	  sd[i] = 0;
	}
      scanf("%d %d", &N, &R);
      if ( N == 0 && R == 0 ) return 0;
      for ( i = 1; i <= N; i++)
	{
	  d[i] = N - i + 1;
	}
      for ( i = 1; i <= R; i++)
	{
	  scanf("%d %d", &n, &r);
	  q = n;
	  for( j = 1; j <= r; j++, n++)
	    {
	      sd[j] = d[n];
	    }
	  for ( j = 0; j < n - 1; j++)
	    {
	      d[q+r-1] = d[q-1];
	      q--;
	    }
	  for( j = 1; j <= r; j++)
	    {
	      d[j] = sd[j];
	    }
	}
      printf("%d\n", d[1]);
    }
  return 0;
}