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: def base3(K):
      tmp=K
      S=""
      while(True):
          S=str(tmp%3)+S
          tmp=tmp//3
          if tmp==0:
              break
      return S
  L=int(input())
  T=base3(L)[::-1]
  N=len(T)
  A=[]
  for i in range(N-1):
      tmp=3**i
      for k in range(3):
          A.append((i+1,i+2,k*tmp))
  bef=0
  for i in range(N)[::-1]:
      tmp=3**i
      for k in range(int(T[i])):
          A.append((i+1,N+1,bef+k*tmp))
      bef+=int(T[i])*tmp
  print(N+1,len(A))
  for p in A:
      print(p[0],p[1],p[2])ans=(n//k)**3
  
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"}]