output_description: Print the value of \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K}
  \gcd(a,b,c)}.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      K
attempt: from sys import stdin
  import numpy as np
  
  
  def gcd(num_list):
      tmp = np.gcd(num_list[0], num_list[1])
      return np.gcd(tmp, num_list[2])
  
  
  def A():
      n = stdin.readline().rstrip()
      flag = bool()
  
      for st in n:
          if st == "7":
              flag = True
  
      if flag:
          print("Yes")
      else:
          print("No")
  
  
  def B():
      n = stdin.readline().rstrip()
      sum = 0
  
      for i in range(1, int(n) + 1):
          if not (i % 3 == 0 or i % 5 == 0):
              sum = sum + i
  
      print(sum)
  
  
  def C():
      n = stdin.readline().rstrip()
      sum = 0
      lis = list()
  
      lis = [
          [a, b, c]
          for a in range(1, int(n) + 1)
          for b in range(1, int(n) + 1)
          for c in range(1, int(n) + 1)
      ]
  
      for i in lis:
          sum = sum + gcd(i)
  
      print(sum)
  
  
  if __name__ == "__main__":
      C()
  
problem_description: Statement
  
  Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}.
  
  Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c.
samples: [{"input": "2", "output": "9\n    \n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2) =1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\n* * *"}, {"input": "200", "output": "10813692"}]