let n, k = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)

let rec pow x n = if n = 1 then x else x * pow x (n - 1)

let () =
  let a = n / k in
  let b = (n - k / 2) / k + 1 in
  Printf.printf "%d\n" @@ pow a 3 + if k mod 2 = 0 then pow b 3 else 0