result = []

loop do
	n,r = gets.split(" ").map(&:to_i)
	break if n == 0 && r == 0
	ary = [*1..n].reverse
	s = r.times.map{gets.to_s}
	s.each{|pc| p,c=pc.split(" ").map(&:to_i)
		ary1 = ary[0..p-2]
		ary2 = ary[p-1..p+c-2]
		ary2.concat(ary1).concat(ary[p+c-1..n-1])
		ary = ary2
	}
	result << ary[0]
end
result.each{|val| puts val}