loop{

if (target = gets.to_i) == 0
	break
end

time = Array.new(gets.to_i);

time.size.times do |i|
	time[i] = gets.chomp
	target = target - (time[i].split(nil)[1].to_i - time[i].split(nil)[0].to_i)
end

if target <= 0
	print "OK\n"
elsif
	print target,"\n"
end

}