min_x = 0 max_x = 10**9 ans = 140 100.times do x = (max_x - min_x) / 2 + min_x print "? #{x}\n" #print "? #{x} #{min_x} #{max_x}\n" STDOUT.flush y = gets.strip.to_i #if x >= ans # y = 1 #else # y = 0 #end if y == 1 max_x = x else min_x = x end if max_x - min_x == 1 break end end print "! #{max_x}\n"