import Control.Applicative ((<$>)) main :: IO () main = do solve <$> getl (map read . words) >>= print solve :: [Int] -> Int solve [l, k] = let (c, r) = l `divMod` (2 * k) in if r == 0 then (c - 1) * k else c * k getl :: (String -> a) -> IO a getl f = f <$> getLine