for i in 1..50 do

  number_of_cards, shuffle_times = gets.split.map(&:to_i)
  if number_of_cards == 0 && shuffle_times == 0 then exit end

  cards = []
  for j in 1..number_of_cards do
    cards << j
  end

  for j in 1..shuffle_times do
    point, c = gets.split.map(&:to_i)

    s = number_of_cards - point - c + 1
    stay = []
    shuffle = []
    for k in 1..number_of_cards do
      if k <= s then
        stay << cards[k-1]
      elsif k <= s + c then
        shuffle << cards[k-1]
      else
        stay << cards[k-1]
      end
    end

    cards = stay + shuffle
  end

  puts(cards.pop)

end