object Main{
  def cut(cards: Array[Int],p:Int,c:Int): Array[Int] = {
    cards.slice(p-1,p-1+c) ++ cards.take(p-1) ++ cards.drop(p+c-1)
  }
  def main(args: Array[String]){
    var nr = readLine.split(" ").map( n => n.toInt )
    var n = nr(0)
    var r = nr(1)
    while(n>0&&r>0){
      var cards = new Array[Int](n)
      for(i <- 0 until n) cards(i) = n-i
      for(i <- 0 until r){
        val pc = readLine.split(" ").map( n => n.toInt )
        val p = pc(0)
        val c = pc(1)
        cards = cut(cards,p,c)
      }
      println( cards.head )
      nr = readLine.split(" ").map( n => n.toInt )
      n = nr(0)
      r = nr(1)
    }
  }
}