-- ref: https://yukicoder.me/submissions/474461 import Text.Printf (printf) main :: IO () main = do [p, q] <- map read . words <$> getLine printf "%.9f\n" $ solve p q solve :: Double -> Double -> Double solve p q = solve' 1 3.6e10 where solve' :: Double -> Double -> Double solve' l r | abs fc < eps = c | fc < 0 = solve' c r | otherwise = solve' l c where c = (l + r) / 2 fc = f c f n = n * n - q * n * logBase 2 n - p eps = 1e-6 :: Double