output_description: Print the number of triples (a,b,c) of positive integers not greater than N
  such that a+b,b+c and c+a are all multiples of K.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
attempt: from heapq import heappush, heappop, heapify
  from collections import deque, defaultdict, Counter
  import itertools
  from itertools import permutations, combinations, accumulate
  import sys
  import bisect
  import string
  import math
  import time
  
  
  def I():
      return int(input())
  
  
  def S():
      return input()
  
  
  def MI():
      return map(int, input().split())
  
  
  def MS():
      return map(str, input().split())
  
  
  def LI():
      return [int(i) for i in input().split()]
  
  
  def LI_():
      return [int(i) - 1 for i in input().split()]
  
  
  def StoI():
      return [ord(i) - 97 for i in input()]
  
  
  def ItoS(nn):
      return chr(nn + 97)
  
  
  def input():
      return sys.stdin.readline().rstrip()
  
  
  def show(*inp, end="\n"):
      if show_flg:
          print(*inp, end=end)
  
  
  def print_matrix(mat):
      for i in range(len(mat)):
          print(*mat[i])
  
  
  yn = {False: "No", True: "Yes"}
  YN = {False: "NO", True: "YES"}
  MOD = 10**9 + 7
  inf = float("inf")
  IINF = 10**10
  l_alp = string.ascii_lowercase
  u_alp = string.ascii_uppercase
  ts = time.time()
  sys.setrecursionlimit(10**6)
  nums = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
  
  show_flg = False
  # show_flg = True
  
  
  def main():
      N, K = MI()
      a = []
      cur = K
      half = []
      zero = []
  
      dic = defaultdict(int)
  
      for i in range(1, N + 1):
          if K % 2 == 1 and i % K == 0:
              zero.append(i)
          if K % 2 == 0 and i % K == K // 2:
              half.append(i)
          if K % 2 == 0 and i % K == 0:
              zero.append(i)
  
      a = len(zero)
      b = len(half)
  
      print(a**3 + b**3)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  You are given integers N and K. Find the number of triples (a,b,c) of positive
  integers not greater than N such that a+b,b+c and c+a are all multiples of K.
  The order of a,b,c does matter, and some of them can be the same.
samples: [{"input": "3 2", "output": "9\n    \n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3)\nsatisfy the condition.\n\n* * *"}, {"input": "5 3", "output": "1\n    \n\n* * *"}, {"input": "31415 9265", "output": "27\n    \n\n* * *"}, {"input": "35897 932", "output": "114191"}]