class Yukicoder def initialize a = 1 b = 10 ** 9 while a < b-1 c = (a+b)/2 puts "? #{c}" STDIN.flush result = gets.to_i if result > 0 a = c else b = c-1 end end puts "! #{a}" STDIN.flush end end Yukicoder.new