#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	ll N, K;
	cin >> N >> K;
	ll t0 = N / K, t1 = K & 1 ? 0 : max(0LL, (N + K / 2) / K);
	cout << t0 * t0 * t0 + t1 * t1 * t1 << endl;
	return 0;
}
