program arc102_a
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,k,i
    integer(int32):: a0, ah
    read*, n,k
    a0=n/k
    ah=0
    if (mod(k,2) == 0) then
        do i=1,n
            if (mod(i,k) == k/2) ah=ah+1
        end do
    end if

    print'(i0)', a0**3 + ah**3


end program arc102_a