fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map(String::toLong)

    if (K % 2 == 0L) {
        var x = N / K
        var y = (N + K/2) / K
        println(x * x * x + y * y * y)
    } else {
        var x = N / K
        println(x * x * x)
    }
}