#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int main() {
    LL n, k;
    cin >> n >> k;

    LL x = n/k;
    LL ans = x*x*x;

    if (k % 2 == 0) {
        LL y = (n+k/2)/k;
        ans += y*y*y;
    }

    cout << ans << endl;


    return 0;
}
