// C - Triangular Relationship
// https://abc108.contest.atcoder.jp/tasks/arc102_a

import scala.io.StdIn.readLine

object Main extends App {

  val Array(n, k) = readLine.split(" ").map(_.toInt)

  val ans: Int = if (k % 2 == 0) {
    val a = n / k
    val b = n / (k / 2) - n / k
    a * a * a + b * b * b
  } else {
    val a = n / k
    a * a * a
  }

  println(ans)

}
