program sample
    implicit none
  
    integer(8) :: a,b,c,d,i,j,n,h,w,k,m,x(4),sum
  
    
  
    ! 整数を読み込む
    read(*,*) n,k
    
        m=n/k
        sum=m**3
    if(mod(k,2)==1)then
            write(*,*)sum
    else
        if(mod(n,k)>=k/2)then
            m=n/k+1
        else
            m=n/k
        end if
        sum=sum+m**3
        write(*,*)sum
    end if
    


    stop
  end program sample
  