program triangular_relationship
  implicit none
  integer(8) :: n, k, ans
  read(*,*) n, k
  ans = (n/k)**3
  if (mod(k,2_8) == 0_8) ans = ans+((n+k/2_8)/k)**3
  write(*,'(i0)') ans
end program triangular_relationship