
main :: IO ()
main = do
  [n, k] <- map read.words <$> getLine :: IO [Int]
  if odd k
    then
      print $ (n `div` k) ^ 3
    else let m = (n `div` (k`div`2))
      in if odd m
        then print $ (m`div`2+1) ^ 3 + (m`div`2) ^ 3
        else print $ (m`div`2) ^ 3 + (m`div`2) ^ 3
