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: # ユークリッドの互除法
  
  
  def euclid(m, n):
      # m > n となるように入れ替え
      if m < n:
          m, n = n, m
      while n != 0:
          m, n = n, m % n
      return m
  
  
  num = int(input(""))  # input()で入力を受け取ってint()で数字型に変換します。
  ans_sum = 0
  
  for a in range(1, num + 1):
      for b in range(1, a):
          gcd_ab = euclid(a, num + 1)
          for c in range(1, num + 1):
              ans_sum = ans_sum + euclid(gcd_ab, c)
  
  ans_sum = ans_sum * 2
  
  print(ans_sum)
  
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"}]