Language: C

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		long ans=0;
		for(int i = 1;i<=n;i++) {
			for(int j = 1;j<=n;j++) {
				for(int k = 1;k<=n;k++) {
					ans+=Gcd(i,Gcd(j,k));
				}
			}
		}
		Console.WriteLine("{0}",ans);
	}
	static long Gcd(long a,long b){
		long c=Max(a,b)%(b=Min(a,b));
		while(c!=0){
			a=b%c;
			b=c;
			c=a;
		}
		return b;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using System;
      | ^~~~~
main.c:2:1: error: unknown type name 'using'
    2 | using System.Collections.Generic;
      | ^~~~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | using System.Collections.Generic;
      |             ^
main.c:3:1: error: unknown type name 'using'
    3 | using System.Collections;
      | ^~~~~
main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | using System.Collections;
      |             ^
main.c:4:1: error: unknown type name 'using'
    4 | using System.Collections.Specialized;
      | ^~~~~
main.c:4:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    4 | using System.Collections.Specialized;
      |             ^
main.c:5:1: error: unknown type name 'using'
    5 | using System.Linq;
      | ^~~~~
main.c:5:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    5 | using System.Linq;
      |             ^
main.c:6:1: error: unknown type name 'using'
    6 | using System.Text;
      | ^~~~~
main.c:6:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    6 | using System.Text;
      |             ^
main.c:7:1: error: unknown type name 'using'
    7 | using System.IO;
      | ^~~~~
main.c:7:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    7 | using System.IO;
      |             ^
main.c:8:1: error: unknown type name 'using'
    8 | using System.Reflection;
      | ^~~~~
main.c:8:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | using System.Reflection;
      |             ^
main.c:9:6: error: expected ';' before 'static'
    9 | using static System.Math;
      |      ^~~~~~~
      |      ;
main.c:9:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    9 | using static System.Math;
      |                    ^
main.c:10:1: error: unknown type name 'using'
   10 | using System.Numerics;
      | ^~~~~
main.c:10:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   10 | using System.Numerics;
      |             ^
main.c:11:8: error: unknown type name 'class'
   11 | static class Program{
      |        ^~~~~
main.c:11:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   11 | static class Program{
      |                     ^
main.c:37:1: error: unknown type name 'public'
   37 | public class Sc{
      | ^~~~~~
main.c:37:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Sc'
   37 | public class Sc{
      |              ^~