#include<iostream>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	long long q = n / k;
	long long ans = q * q * q;
	if(k % 2 == 0) {
		long long o = (n+k/2)/k;
		ans += o * o * o;
	}
	cout << ans << endl;
	return 0;
}
