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 math import (
      ceil,
      floor,
      factorial,
      gcd,
      sqrt,
      log2,
      cos,
      sin,
      tan,
      acos,
      asin,
      atan,
      degrees,
      radians,
      pi,
      inf,
  )
  from itertools import (
      accumulate,
      groupby,
      permutations,
      combinations,
      product,
      combinations_with_replacement,
  )
  from collections import deque, defaultdict, Counter
  from bisect import bisect_left, bisect_right
  from operator import itemgetter
  from heapq import heapify, heappop, heappush
  from queue import Queue, LifoQueue, PriorityQueue
  from copy import deepcopy
  from time import time
  import string
  import sys
  
  sys.setrecursionlimit(10**7)
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST():
      return list(MAP())
  
  
  n, k = MAP()
  a = n // k
  if k % 2 == 0:
      b = n // (k // 2) - a
  else:
      b = 0
  
  ans = a + max(a * (a - 1) * 3, 0) + max(a * (a - 1) * (a - 2), 0)
  ans += b + max(b * (b - 1) * 3, 0) + max(b * (b - 1) * (b - 2), 0)
  print(ans)
  
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"}]