n,r = gets.split.map(&:to_i)
while n !=0 && r != 0
	res = []
	n.downto(1) do |i|
		res.push(i)
	end
	0.upto(r-1) do |i|
		p,c = gets.split.map(&:to_i)
		tmp = []
		(p-1).upto(p+c-2) do |i|
			tmp.push(res[i])
		end
		0.upto(n-1) do |i|
			next if p-1 <= i && i < p + c -1 
			tmp.push(res[i])
		end
		res = tmp
	end
	n,r = gets.split.map(&:to_i)
	puts res[0]
end