#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main() {
    int n,k;
    cin >> n >> k;
    ll ans=pow(n/k,3);
    if (k%2==0) ans+=pow(n/(k/2)-n/k,3);
    
    cout << ans << endl;
}