fun main(args: Array<String>) {
    val(N,K) = readLine()!!.split(" ").map{it.toLong()}
    val n = N/K
    if(K%2==1L){
        println(n*n*n)
    }else{
        val z= N/(K/2) - N/K
        println(n*n*n+z*z*z)
    }

}