// C - Triangular Relationship
// https://abc108.contest.atcoder.jp/tasks/arc102_a

import scala.io.StdIn.readLine

object Main extends App {

  val Array(n, k) = readLine.split(" ").map(_.toInt)

  val (same: Int, diff: Int) = if (k%2 == 0) {
    val same = 2 * n / k
    val diff = if (n%2 == 0) same * (same - 2) / 4
      else ((same-2)/2+1)*((same-2)/2+1) 
    (same, diff)
  } else {
    val same = n / k
    val diff = same * (same - 1) / 2
    (same, diff)
  }

  val ans = same + (diff * 6)

  println(ans)

}
