#include <stdio.h>

#define N 64

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    int d[ N ];
    int n, r;

    scanf ( "%d%d", &n, &r );
    if ( !( n | r ) ) break ;

    for ( i = 0; i < n; ++i )
    {
      d[ i ] = n - i;
    }

    while ( r-- )
    {
      int t[ N ];
      int p, c;

      scanf ( "%d%d", &p, &c );

      for ( i = 0; i < p - 1; ++i )
      {
        t[ i ] = d[ i ];
      }
      for ( i = 0; i < c; ++i )
      {
        d[ i ] = d[ p - 1 + i ];
      }
      for ( i = 0; i < p - 1; ++i )
      {
        d[ c + i ] = t[ i ];
      }
    }

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

  return ( 0 );
}