import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n, k = sc.nextLong()

    if (k % 2L != 0L) {
      println(pow(n / k, 3))
    } else {
      val m = n / (k / 2)
      val max = (m + 1) / 2
      val min = m - max
      debug(max, min)
      println(pow(max, 3) + pow(min, 3))
    }
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def pow(n: Long, x: Long): Long = {
    x match {
      case 0L              => 1L
      case 1L              => n
      case a if a % 2 == 0 => pow(n * n, x / 2)
      case a               => n * pow(n, x - 1)
    }
  }
}
