import System.IO import Data.List main = main' 1 (10^9) main' lo hi | succ lo == hi = do putStrLn ("! " ++ show lo) hFlush stdout | otherwise = do let md = div (lo + hi) 2 putStrLn ("? " ++ show md) hFlush stdout ack <- readLn if ack == 0 then main' md hi else main' lo md