#include <bits/stdc++.h>
using ll = long long;
int main()
{
  int N, K;
  std::cin >> N >> K;
  auto cb = [](const ll n){return n*n*n;};
  std::cout << (K%2==1?cb(N/K):cb(N/K)+cb((N+K/2)/K)) << std::endl;
  return 0;
}