import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {

    const tmp = readln.split.to!(long[]);
    const N = tmp[0], K = tmp[1];

    const a = N/K;
    const b = (K&1) ? 0 : (N+K/2)/K;

    writeln(a^^3 + b^^3);
}
