Let's denote *d*(*n*) as the number of divisors of a positive integer *n*. You are given three integers *a*, *b* and *c*. Your task is to calculate the following sum:

Find the sum modulo 1073741824 (2<sup class="upper-index">30</sup>).
The first line contains three space-separated integers *a*, *b* and *c* (1 ≤ *a*, *b*, *c* ≤ 2000).
using System;

namespace md_ejer_235c_explic
{
    class Program
    {
        static  long  ll;
        //typedef pair<int, int>P;
        //const int INF = 0x3f3f3f3f, 
        const int maxn = 2001;
        const long mod = 1073741824;
        static int[,] gcd = new int[maxn, maxn];
        static int[] mu = new int[maxn];
        static int[] p = new int[maxn/3];
        static int[] vis = new int[maxn];
        static long res;

        static void init(int n = 2000)
        {
            res = 0;
            mu[1] = 1;
            for (int i = 2; i <= n; i++)
            {
                if (vis[i] == 0)
                    { p[res++] = i; mu[i] = -1; }

                for (int j = 0; j < res && i * p[j] <= n; j++)
                {
                    vis[i * p[j]] = 1;
                    if (i % p[j] == 0)
                    {
                        mu[i * p[j]] = 0;
                        break;
                    }                  
                    else
                        mu[i * p[j]] = -mu[i];
                }
            }
            for (int i = 0; i <= n; i++) gcd[i,0] = gcd[0,i] = i;

            for (int i = 1; i <= n; i++)
                for (int j = 1; j <= i; j++)
                {
                    gcd[j, i] = gcd[j, i % j];
                    if (gcd[i, j] != gcd[j, i])
                        gcd[i, j] = gcd[j, i];
                }
            //for (int i = 0; i < 20; i++)
            //{
            //    Console.WriteLine(gcd[10, i]);
            //}
            //Console.WriteLine("10,8=" + gcd[10, 8]);
        }

        static int deal(int n, int d, int i)
        {
            int ans = 0;
            for (int j = 1; j <= n; j++)
                if (gcd[i,j * d] == 1) ans += n / j;
            return ans;
        }

        static void Main(string[] args)
        {
            init();
            int a = 4; int b = 4; int c = 4;
            string[] entrada = new string[3];

            while (true)
            {
                  Console.WriteLine("Teclee los 3 numero dando enter (el explicado)");
                entrada = (Console.ReadLine()).Split(' ');
                a = int.Parse(entrada[0]);
                b = int.Parse(entrada[1]);
                c = int.Parse(entrada[2]);
                int minbc = Math.Min(b, c);
                long ans = 0;
                for (int i = 1; i <= a; i++)
                {
                    long res = 0;
                    for (int d = 1; d <= minbc; d++)
                    {
                        //res +=  ((mu[d] * deal(b / d, d, i) * deal(c / d, d, i))  % mod + mod) % mod;
                        res += (mu[d] * deal(b / d, d, i) * deal(c / d, d, i)) ; //% mod + mod) % mod;
                      //  if (res >= mod) res -= mod;
                    }
                    ans +=  (a / i) * res  ;
                    //ans += (a / i) * res % mod;
                    //if (ans >= mod)
                    //    ans -= mod;
                }
                ans &= 1073741823;
                Console.WriteLine(ans);
                
            }
        }
    }
}
