(<&>) = flip fmap

main = do
    [n, k] <- map read . words <$> getLine
    let modEqualList = [0] ++ (if (even k) then [quot k 2] else [])
    let correction x = if x /= 0 then 1 else 0
    let combinations = modEqualList <&> (\e -> (quot (n - e) k) + correction e) <&> (flip (^) 3)
    putStrLn $ show $ sum combinations
