import std.stdio;
import std.algorithm;
import std.range;
import std.conv;
import std.format;
import std.array;
import std.math;
import std.string;
import std.container;

void main() {
  int N, K; readlnTo(N, K);

  int a = N / K;
  if (K % 2 == 1) {
    writeln(a * a * a);
  } else {
    int b = N / (K / 2) - a;
    writeln(a * a * a + b * b * b);
  }
}

// helpers
void readlnTo(T...)(ref T t) {
  auto s = readln.split;
  assert(s.length == t.length);
  foreach(ref ti; t) {
    ti = s[0].to!(typeof(ti));
    s = s[1..$];
  }
}
