package main; import java.util.*; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int min = 1; int max = (int) 1e9; while (min + 1 != max) { int tmp = (min + max) / 2; System.out.println("? " + tmp); int t = sc.nextInt(); if (t == 1) { min = tmp; } else { max = tmp; } } System.out.println("! " + min); } }