import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n, k;
	scanf("%d%d", &n, &k);
	long ans = 0;
	long f(long x) {
		return x*x*x;
	}
	ans += f(n/k);
	if (k%2 == 0) ans += f((n+k/2)/k);
	writeln(ans);
}