program main
  implicit none
  integer :: n, k, full, half
  read(*, *) n, k

  full = n / k
  if (mod(k, 2) == 0) then
    half = (n + k / 2) / k
  else
    half = 0
  end if

  write(*, "(i0)") full ** 3 + half ** 3
end program main
