import scala.io.StdIn._
object Main extends App {
  val Array(n, k) = readLine.split(" ").map{_.toInt}
  println(if ((k & 1) == 1) calcOdd(n, k) else calcEven(n, k))

  def calcOdd(n: Int, k: Int): Long = {
    val l = n.toLong / k
    l * l * l
  }

  def calcEven(n: Int, k: Int): Long = {
    ((k / 2) to k by (k / 2)).map {a =>
      val l = (n - a).toLong / k + 1
      l * l * l
    }.sum
  }
}
