import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[] x = new int[25]; System.out.println("? 0"); int i = 0; int ok = 1000000; int ng = 0; while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; int cx = x[i]; i++; int nx = mid * 2 - cx; x[i] = nx; System.out.println("? " + nx); int res = sc.nextInt(); if (cx < nx) { if (res == 0) { ok = mid; } else { ng = mid; } } else { if (res == 1) { ok = mid; } else { ng = mid; } } } System.out.println("! " + ok); sc.close(); } }