until (n, r = gets.split.map(&:to_i)) == [0, 0]
  d = (1..n).to_a.reverse
  r.times do
    p, c = gets.split.map(&:to_i)
    t = d.slice!(p - 1, c)
    t.reverse.each{|i|d.unshift(i)}
  end
  puts d[0]
end