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

  def calcOdd: Long = {
    val l = n / k
    l * l * l
  }

  def calcEven: Long = {
    val sumK = {
      val l = n / k
      l * l * l
    }

    val sumKHalf = {
      val l = (n + k / 2) / k
      l * l * l
    }
    sumK + sumKHalf
  }
}