import Control.Applicative

main :: IO ()
main = solve <$> f >>= print
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> Int
solve [n, k]
  | odd k = c0
  | otherwise = c0 + c1
  where
    c0 = (n `div` k) ^ 3
    c1 = ((n - (k `div` 2)) `div` k + 1) ^ 3
