import Control.Applicative ((<$>)) import Text.Printf (printf) computeMax :: RealFloat a => a -> a -> a computeMax c d | 3.5 * c <= 1.4 * d = f 0 $ 3.5 * c | 1 / 3 * c <= d && 1.4 * d < 3.5 * c = f xp yp | otherwise = f (4 * d) 0 where f x y = 1000 * x + 2000 * y xp = 20 / 13 * c - 8 / 13 * d yp = -7 / 13 * c + 21 / 13 * d main :: IO () main = do [c, d] <- fmap read . words <$> getLine :: IO [Double] printf "%.12f\n" (computeMax c d)