l, r = 10, 1_000_000_000 border = (l + r) / 2 puts "? #{border}" STDOUT.flush while (res = gets.not_nil!.to_i) != 0 if res == 1 l = border - 1 r -= 1 else r = border - 2 l -= 1 end border = [(l + r + 1) / 2, 0].max puts "? #{border}" STDOUT.flush end puts "! #{border - 1}" STDOUT.flush