import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val K = sc.nextInt()

    var p0: Long = 0
    var ph: Long = 0
    for (i in 1..N) {
        when (i % K) {
            0 -> p0++
            K / 2 -> ph++
        }
    }
    if (K % 2 == 1) ph = 0
    println(p0 * p0 * p0 + ph * ph * ph)
}