#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n, k, p;
int main(){
	cin>>n>>k;
	p=n/k;
	if(k%2==1){
		cout<<p*p*p;
		return 0;
	}
	else {
		ll q=(n+k/2)/k, x=0;
		cout<<p*p*p+q*q*q;
		return 0;
	}
}