fun main(args:Array<String>){
    val input = readLine()!!.split(" ")
    val N = input[0].toLong()
    val K = input[1].toLong()

    var c: Long = N/K
    c = c*c*c

    if (K%2 == 0L) {
        val k: Long = (N+K/2)/K
        c += k*k*k
    }

    println(c)
}