ans = []

loop do
  num_of_cards, cut_time = gets.split.map(&:to_i)

  if [num_of_cards, cut_time] == [0, 0]
    break

  else
    cards = Array.new(num_of_cards, 0)

    num_of_cards.times do |i|
      cards[i] = num_of_cards - i
    end

    cut_time.times do
      a, b = gets.split.map(&:to_i)
      first = a - 1
      last  = a + b - 2
      cards2 = cards[first .. last]
      if first > 0
        cards2 = cards2 + cards[0 .. first - 1]
      end
      if last < num_of_cards - 1
        cards2 = cards2 + cards[last + 1 .. num_of_cards - 1]
      end
      cards[0 .. num_of_cards] = cards2[0 .. num_of_cards]
      cards2.clear
    end

    ans << cards[0]
  end
end

ans.each do |a|
  puts a
end

