import scala.io.StdIn._
object Main extends App {
  val Array(n, k) = readLine.split(" ").map(_.toLong)
  if (k % 2 == 0) {
    val i = n / k
    val j = (n + k / 2) / k
    println((i * i * i) + (j * j * j))
  } else {
    val i = n / k
    println(i * i * i)
  }
}
