import java.util.Scanner;
public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
} Main public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    } main {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc long result = 0; result 0 for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	} int i = 1; int i = 1; i 1 i <= a i a i++ i++ i {
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	} {
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	} for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		} int j = i; int j = i; j i j <= a j a j++ j++ j {
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		} {
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		} for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			} int k = j; int k = j; k j k <= a k a k++ k++ k {
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			} {
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			} boolean judge = true; judge true for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				} int l = i; int l = i; l i l > 0 && judge l > 0 l 0 judge l-- l-- l {
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				} {
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				} if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					} i % l == 0 && j % l == 0 && k % l == 0 i % l == 0 && j % l == 0 && k % l == 0 i % l == 0 i % l i l 0 j % l == 0 j % l j l 0 k % l == 0 k % l k l 0 {
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					} judge = false judge false if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            } i == j && j == k i == j i j j == k j k {
                             	result += l; 
                            } result += l result l if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            } i != j && j != k && i != k i != j && j != k && i != k i != j i j j != k j k i != k i k {
                              	result += (l * 6);
                            } result += (l * 6) result (l * 6) l 6 {
                              	result += (l * 3);
                            } result += (l * 3) result (l * 3) l 3 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
} public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
} Main
import java.util.Scanner;
public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
}
