#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL f(LL x){
	return x * x * x;
}
int main(){
	LL N, K;
	scanf("%lld %lld", &N, &K);
	if(K & 1) printf("%lld", f(N / K));
	else printf("%lld", f(N / K) + f(N / K + (N % K >= K / 2)));
}