let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let count_k = Array.make k 0 in
  for i = 1 to n do
    count_k.(i mod k) <- 1 + count_k.(i mod k)
  done;
  Printf.printf "%d\n" @@
  if k mod 2 = 0 then 
    count_k.(0) * count_k.(0) * count_k.(0)
    + count_k.(k / 2) * count_k.(k / 2) * count_k.(k / 2)
  else
    count_k.(0) * count_k.(0) * count_k.(0)
