import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val K = sc.nextInt

    var result = 0
    val i1 = (N - K) / K + 1
    result += i1 * i1 * i1
    if (K % 2 == 0) {
      val i2 = (N - K / 2) / K + 1
      result += i2 * i2 * i2
    }

    result.toString
  }
}
