object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    var n, r = sc.nextInt
    while(n != 0 || r != 0) {
      var cards = (1 to n).toList.reverse
      for(_ <- 1 to r) {
        val p, c = sc.nextInt
        cards = cards.take(c + p - 1).drop(p - 1) ::: cards.take(p - 1) ::: cards.drop(c + p - 1)
      }
      println(cards.head)
      n = sc.nextInt; r = sc.nextInt
    }
  }
}