import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [n, k] <- map (read::String -> Int) . words <$> getLine
  let multiples = n `div` k
      halves = n `div` (k `div` 2) - multiples
  if k `mod` 2 == 1
    then print $ multiples * multiples * multiples
    else print $ multiples * multiples * multiples + halves * halves * halves