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

#define int long long

signed main(){
    int n, k;
    cin >> n >> k;
    int t = n/k;
    t = t*t*t;
    int a = 0;
    if(k % 2 == 0){
        a = (n + k/2) / k;
    	a = a*a*a;
    }
    cout << t + a;
    return 0;
}