program prob5
    implicit none
    integer(8) :: n, k
    integer(8) :: ans
    read(*,*) n, k
    ans = 0
    if(mod(k , 2) == 0) then
        ans = (N/K) * (N/K) * (N/K)
        ans = ans + ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2
    else
        ans = (N/K) * (N/K) * (N/K)
    end if
    write(*,*) ans
    stop
contains
end program prob5