main = solve (0 ,10 ^ 9) solve :: (Int, Int) -> IO () solve (x, y) = putStrLn ("? " ++ show y') >> getLine >>= judge . (read :: String -> Int) where y' = (x + y) `div` 2 judge n | n == 1 && (y == y' || y - y' == 1) = putStrLn ("! " ++ show y') | n == 1 = solve (y', y) | otherwise = solve (x, y')