def binary_search(f): left,right=1,10**6+1 while right-left>1: mid=(right+left)//2 if f(mid): right=mid else: left=mid return left a = 21 def ask(x,x_d): print('?', x_d) return int(input()) if abs(a-x) >= abs(a-x_d): print("1") return 1 return 0 def f(x): global s if s < 0: s_d = s+abs(s-x)*2 else: s_d = s-abs(s-x)*2-1 r=ask(s,s_d) s = s_d if r == -1: assert False if r == 1: if s < 0: return True else: return False else: if s < 0: return False else: return True s = 10**7 print('?', s) a=binary_search(f) print('!', a)