"use strict"

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const N = input[0]
  const K = input[1]

  let ans = 0

  if (K % 2 === 1) {
    //奇数
    for (let i = 1; i <= N; i++) {
      if (i % K === 0) ans++
    }
    ans = Math.pow(ans, 3)
  } else {
    //偶数
    let tmp = 0
    let tmp2 = 0
    for (let i = 1; i <= N; i++) {
      if (i % K === K / 2) {
        tmp++
      }
      if (i % K === 0) {
        tmp2++
      }
    }
    ans += Math.pow(tmp, 3)
    ans += Math.pow(tmp2, 3)
  }

  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))