Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.

The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.

Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.

NoteThis is what Gerald's hexagon looks like in the first sample:And that's what it looks like in the second sample:

#include <stdio.h>
#include <math.h>

double opposite(double a, double b)
{
    double pi = 2*acos(0);
    return sqrt(a*a + b*b - 2*a*b*cos(120 * pi / 180));
}

int main()
{
    double a1, a2, a3, a4, a5, a6, t1, t2, t3, middle, s, side1, side2, side3, ans, pi = 2*acos(0);
    double dividor = (sqrt(3) / 4 );
    double high, low;

    scanf("%lf %lf %lf %lf %lf %lf", &a1, &a2, &a3, &a4, &a5, &a6);

    t1 = 0.5 * a1 * a2 * sin(120 * pi / 180);
    t2 = 0.5 * a3 * a4 * sin(120 * pi / 180);
    t3 = 0.5 * a5 * a6 * sin(120 * pi / 180);

    side1 = opposite(a1, a2);
    side2 = opposite(a3, a4);
    side3 = opposite(a5, a6);
    s = (side1 + side2 + side3) / 2;

    middle = sqrt(s * (s-side1) * (s-side2) * (s-side3));

    ans = ( t1 + t2 + t3 + middle ) / dividor;
    high = ceil(ans);

    if ( abs(high - ans) < 0.4 )
    {
        printf("%d", (int)high );
        return 0;
    }

    printf("%d", (int)ans);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>

int mxpw(x, b){
    int res = 1;
    while(res*b < x) res *= b;
    return res;
}

int main(){
    int* T = calloc(sizeof(int), 6);
    int a, ai, d, p1, p2;
    scanf("%d", T++);
    scanf("%d", T++);
    scanf("%d", T++);
    scanf("%d", T++);
    scanf("%d", T++);
    scanf("%d", T++);
    T -= 6;
    a = 1000000000;
    ai = 0;
    for(int i = 0; i < 6; i++) if(T[i] < a){ai = i; a = T[i];}
    d = abs(a - T[(ai+3)%6]);
    p2 = abs(a - T[(ai+2)%6]);
    p1 = abs(a - T[(ai+4)%6]);

    printf("%d", 6*a*a+6*a*d+d*d+(2*a+d)*2*p1+2*p2*(2*a+d+p1));

    return 0;
}

#include<stdio.h>
int main()
{
    int a1,a2,a3,a4,a5,a6;
    scanf("%d %d %d %d %d %d",&a1,&a2,&a3,&a4,&a5,&a6);

    long int s=a1+a2+a3;
    long int ans;

    ans=s*s-a1*a1-a3*a3-a5*a5;

    printf("%ld",ans);

    return 0;
}

#include <stdio.h>

int main()
{
	int a,b,c,d,e,f,k,g;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	k=(a+b+c)*(a+b+c);
	g=a*a+c*c+e*e;
	printf("%d",k-g);
	return 0;
}

#include <stdio.h>
int main()
{
    int a, b, c, d, e, f;
    scanf ( "%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f );
    int len = e+d+c;
    int ans = len*len;
    ans = ans - c*c - a*a - e*e;
    printf ( "%d\n", ans );
    return 0;
}

#include "stdio.h"
#include "stdlib.h"

int a, b, c, d, e, f;

int main() {

    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);

    printf("%d\n", (a + b + c) * (a + b + c) - a * a - c * c - e * e);

    return 0;
}

#include<stdio.h>
int main ()
{
    long long int a[7],i;
    long long int n1,n2,n3,n_total;
    long long int trigon_delete_one,trigon_delete_two,trigon_delete_three,trigon_total,trigon_final_number;
    long long int final_line_length;
    for(i=1;i<7;i++)scanf("%lld",&a[i]);

    n1=(((a[1]*2)-1)+1)/2,trigon_delete_one=n1*n1,n2=(((a[3]*2)-1)+1)/2,trigon_delete_two=n2*n2,n3=(((a[5]*2)-1)+1)/2,trigon_delete_three=n3*n3,final_line_length=a[1]+a[2]+a[3];

    n_total=(((final_line_length*2)-1)+1)/2,trigon_total=n_total*n_total;

    trigon_final_number=trigon_total-trigon_delete_one-trigon_delete_two-trigon_delete_three;
    printf("%lld\n",trigon_final_number);
    return 0;
}

#include <stdio.h>

int main(void) {
    // your code goes here
    int a,b,c,d,e,f,ta,min1,min2,dif1,dif2;
    //long long int q,sum;

    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);

    min1 = (b>f)?f:b;
    dif1 = (b>f)?(b-f):(f-b);
    min2 = (c>e)?e:c;
    dif2 = (c>e)?(c-e):(e-c);

    ta = (2*a + min1)*min1 + (2*d + min2)*min2 + (a+min1)*dif1 + (d+min2)*dif2;
    printf("%d",ta);

    return 0;
}

#include <stdio.h>
int main(){
        int i,a[6];
        int sysmmetry;
        while(~scanf("%d",&a[0])){
        for(i = 1; i < 6 ; i++)
                scanf("%d",&a[i]);
        sysmmetry = 1;
        for(i = 0; i < 3;i++)
        if(a[i] != a[i + 3]){
                sysmmetry = 0;
                break;
        }
        int num = 0;
        int x1,x2,x3,x5;
        x1 = a[0];
        x2 = a[1];
        x3 = a[2];
        x5 = a[4];
        int tmp = x1 + x2 + x3;
        if(sysmmetry){
                num = tmp * tmp - x1 * x1 - x2 * x2 - x3 * x3;
        }
        else{
                num = tmp * tmp - x1 * x1 - x3 * x3 - x5 * x5;
        }
        printf("%d\n",num);
        }
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    int ans=(a+b+c)*(a+b+c)-a*a-c*c-e*e;
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{
    int i, j, k ,flag=0, n , a,b,c,d,e,f;
    long long count = 0 ;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    while(1)
    {
        if(c==0 || e ==0)
            break;
        count = count + d*2+1;
        //printf("%d\n",count);
        d++;
        c--;
        e--;
    }
    if(c==0)
    {
        while(1)
        {
            if(b==0 || e==0)
                break;

            count = count + d*2;
            //printf("%d\n",count);
            b--;
            e--;
        }
        while(1){
            if(b==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%d\n",count);
            b--;

        }
        printf("%lld\n",count);
    return 0;
    }

    if(e==0)
    {
        while(1)
        {
            if(c==0 || f==0)
                break;
            count = count + d*2;
            c--;
            f--;
        }
        while(1){
            if(f==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%dsfg\n",count);
            f--;

        }

    }
    printf("%lld\n",count);
    return 0;
}

//
//  main.c
//  A. Gerald's Hexagon
//
//  Created by Omer Fehmi Aykan on 6.08.2015.
//  Copyright (c) 2015 Omer Fehmi Aykan. All rights reserved.
//

#include <stdio.h>

int a1, a2, a3, a4, a5, a6;

int main(int argc, const char * argv[]) {

    scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);

    printf("%d", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);

    return 0;
}

#include <stdio.h>
int main()
{
    int a1,a2,a3,a4,a5,a6,i;
    scanf("%d %d %d %d %d %d",&a1,&a2,&a3,&a4,&a5,&a6);

    long long int res;
    res= (a1+a2+a3);
    res=res*res;
    res= res- (a1*a1+a3*a3+a5*a5);
    printf("%d",res);
    return 0;
}

#include <stdio.h>
#include <math.h>
int min(int a,int b)
{
	if(a<b)
	return a;
	else
	return b;
}
int main()
{
	int n,i,arr[6],a,b,ans=0,p,q,rem1,rem2;
	for(i=0;i<6;i++)
	scanf("%d",&arr[i]);
	a=min(arr[1],arr[5]);
	for(i=0;i<a;i++)
	{
		ans=ans+2*(arr[0]+i)+1;
	}
	p=arr[0]+a;
	if(arr[5]>arr[1])
	rem1=arr[5]-arr[1];
	else
	rem1=arr[1]-arr[5];
	b=min(arr[4],arr[2]);
	for(i=0;i<b;i++)
	{
		ans=ans+2*(arr[3]+i)+1;
	}
	q=arr[3]+b;
	ans=ans+2*p*rem1;
	printf("%d\n",ans);
	return 0;
}

/*Gerald's Hexagon*/

#include<stdio.h>

int main()
{
	int a1, a2, a3, a4, a5, a6, side;
	scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);
	side = a3 + a4 + a5;
	printf("%d\n", side * side - a1 * a1 - a3 * a3 - a5 * a5);
	return 0;
}

#include <stdio.h>

int main()
{
	int a, b, c, d, e, f;

	scanf ("%d %d %d %*d %d %*d", &a, &b, &c, &d);

	printf ("%d", (a + b + c) * (a + b + c) - a*a - c*c - d*d);

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
int getmin(int a,int b){
    if(a>b) return b;
    return a;
}
int getmax(int a,int b){
    if(a>b) return a;
    return b;
}
int main()
{
    int l1,l2,l3,l4,l5,l6,x,con,i;
    scanf("%d%d%d%d%d%d" ,&l1,&l2,&l3,&l4,&l5,&l6);
    con=0;
    if(l2>l6){
        x=l1;
       for(i=0;i<l6;i++){
          con=con+2*x+1;
          x++;
       }
       for(i=0;i<l2-l6;i++)
           con+=2*x;
        x=l4;
        for(i=0;i<l3;i++){
            con=con+2*x+1;
            x++;
        }
    }
    else{
       x=l1;
       for(i=0;i<l2;i++){
          con=con+2*x+1;
          x++;
       }
       for(i=0;i<l6-l2;i++)
           con+=2*x;
        x=l4;
        for(i=0;i<l5;i++){
            con=con+2*x+1;
            x++;
        }
    }
    printf("%d" ,con);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{

  int a[6];
  int i;
  for(i=0;i<6;i++)
     {

        scanf("%d",&a[i]);

     }

  int triangle = pow((a[0]+a[1]+a[2]),2);

  int rema     = pow(a[0],2)+pow(a[2],2)+pow(a[4],2);

  printf("%d\n",triangle-rema);

  return 0;

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a, b, c, d, e, f;
    int res=0;
    scanf("%d %d %d %d %d %d", &a,&b,&c,&d,&e,&f);
    res=(a+b+c)*(a+b+c)-a*a-c*c-e*e;
    printf("%d", res);
    return 0;
}

#include <stdio.h>

int main() {
   int a[6],i,side_equi,area;
   for(i=0;i<6;i++) scanf("%d",&a[i]);
   side_equi=a[0]+a[1]+a[2];
   area=side_equi*side_equi-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];
   printf("%d",area);
   return 0;
}

#include<stdio.h>
int main()
{
    long long a,b,c,d,e,f,m;
    scanf("%I64d %I64d %I64d %I64d %I64d %I64d ",&a,&b,&c,&d,&e,&f);
     m=(a+b+c)*(a+b+c)-(a*a+c*c+e*e);
    printf("%I64d",m);
}

#include <stdio.h>

int hexaLine[6];
int regTriCnt;

void find_solution()
{
	int base, r, l, i=1, j=5, n;
	regTriCnt=0;
	base = hexaLine[0];

	r = hexaLine[i++];
	l = hexaLine[j--];
	n = r;
	if (r>l)
		n = l;
	regTriCnt += n*(n+2*base);
	base += n;

	n = r-l;
	if (n<0)
		n*=(-1);
	regTriCnt += 2*n*base;
	r = hexaLine[i++];
	l = hexaLine[j];
	n = r;
	if (r>l)
		n = l;
	base = hexaLine[i];
	regTriCnt+= n*(n+2*base);

}

int main(int argc, char **argv)
{
	int i;
//	freopen("sample_input.txt", "r", stdin);

	for (i=0; i< 6 ; i++)
	{
		scanf("%d", &hexaLine[i]);
	}

	find_solution();
	printf("%d\n", regTriCnt);
	return 0;
}

#include<stdio.h>
int main()
{
	int a,b,c,d,e,f;
	long long int k;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	k=(a+b+c)*(a+b+c);
	k=k-a*a;k=k-c*c;k=k-e*e;
	printf("%I64d",k);
	return 0;
}

#include<ctype.h>
#include<limits.h>
#include<math.h>
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
    int a[7];
    int sum = 0;
    int small, dif;

    for(int i = 1; i < 7; i++)
        scanf("%d", &a[i]);

    dif = abs(a[2] - a[6]);
    if(a[2] > a[6])
        small = a[6];
    else
        small = a[2];

    for(int i = 0; i < small; i++)
        sum += a[1] + i + a[1] + i + 1;
    for(int i = 0; i < dif; i++)
        sum += (a[1] + small) * 2;
    if(a[3] > a[5])
        small = a[5];
    else
        small = a[3];
    for(int i = 0; i < small; i++)
        sum += a[4] + i + a[4] + i + 1;

    printf("%d", sum);

    return 0;
}

#include<stdio.h>
int gum(int k){
	return k*k;
}
int main(){
	int a,b,c,d,e,f,g,h;
	while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&g,&h)){
		printf("%d\n",gum(a+b+c)-gum(a)-gum(c)-gum(e));
	}
	return 0;
}

#include <stdio.h>

int main(void){

    int a, b, c, d ,e, f;
    scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);

    printf("%d\n", (a+b+c)*(a+b+c)-a*a-c*c-e*e);

    return 0;
}

#include <stdio.h>
#define fin stdin
#define fout stdout
int main(){
    int a1, a2, a3, a4, a5, a6, x, i;
    long long ans;
    //FILE *fin, *fout;
    //fin=fopen("a.in", "r");
    //fout=fopen("a.out", "w");
    fscanf(fin, "%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6);
    ans=0;
    x=1+2*a1;
    for(i=0; (i<a2)&&(i<a6); i++){
        ans+=x;
        x+=2;
    }
    x-=2;
    if(a2!=a6){
        x++;
    }
    for(; (i<a2)||(i<a6); i++){
        ans+=x;
    }
    if(a2!=a6){
        x--;
    }
    for(; i<a2+a3; i++){
        ans+=x;
        x-=2;
    }
    fprintf(fout, "%I64d\n", ans);
    fclose(fin);
    fclose(fout);
    return 0;
}

#include<stdio.h>

int main(){
	int arr[6], flag = 0, i;
	for(i = 0;i<6;i++){
		scanf("%d",&arr[i]);
	}
	int j = 0,k = 0, ans = 0;
	int temp = 2*arr[0] + 1;
	while(j<arr[5] && k<arr[1]){
		ans += temp;
		temp = temp+2;
		j++;
		k++;
	}
	temp = temp-2;
	if(j<arr[5]){
		temp++;
		for(i=j;i<arr[5];i++){
			ans +=temp;
		}
		flag = 1;
	}
	else if(k<arr[1]){
		temp++;
		for(i=k;i<arr[1];i++){
			ans +=temp;
		}
		flag = 2;
	}
	else
	{
		for(i=0;i<arr[2];i++){
			ans +=temp;
			temp = temp-2;
		}
		printf("%d\n",ans);
		return 0;
	}
	if(flag == 1){
		temp = 2*arr[3] + 1;
		for(i=0;i<arr[4];i++){
			ans +=temp;
			temp = temp+2;
		}
	}
	else if(flag == 2){
		temp = 2*arr[3] + 1;
		for(i=0;i<arr[2];i++){
			ans +=temp;
			temp = temp+2;
		}
	}
	printf("%d\n", ans);
	return 0;
}

#include "stdio.h"
#include "stdlib.h"

int main(int argc, char ** args) {
	int i, input[6];
	for (i = 0; i < 6; i++) {
		scanf("%d", &input[i]);
	}
	printf("%d\n", (input[0] + input[1] + input[2]) * (input[0] + input[1] + input[2]) - input[0] * input[0] - input[2] * input[2] - input[4] * input[4]);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
	long long int a,b,c,d,e,f,sum;
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	sum=pow(a+b+c,2)-pow(a,2)-pow(e,2)-pow(c,2);
	printf("%lld",sum);
	return 0;
}

#include <stdio.h>
#include <math.h>

double area(int a)
{
    return (sqrt(3)*a*a)/4;
}

int main()
{
    int a, b,c, d, e, f;
    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);

    double n_triangle = area(b+a+c) - area(a) - area(c) - area(e);

    printf("%.0lf\n", n_triangle / area(1));

    return 0;
}

#include <stdio.h>

int main()
{
    int a,b,c,d,e,f,n;
    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
    n = (a+b+c)*(c+d+e)-(a*a+c*c+ e*e);
    printf("%d", n);
    return 0;
}

#include <stdio.h>
#include <math.h>
#define EPS 1e-4

int main()
{
    double a[6];
    int i, j, x;
    for (i = 0; i < 6; ++i) scanf("%lf", &a[i]);
    int turn[6], cur_turn;
    unsigned char valid;
    float px[6], py[6];
    int ans = -1, cur_ans;
    for (x = 0; x < (1 << 10); ++x) {
        for (i = 1; i < 6; ++i) turn[i] = (x >> (i + i)) & 3;
        px[0] = py[0] = cur_turn = 0;
        for (i = 1; i < 6; ++i) {
            switch (turn[i]) {
                case 0: cur_turn += 60; break;
                case 1: cur_turn += 120; break;
                case 2: cur_turn += 240; break;
                case 3: cur_turn += 300; break;
            }
            px[i] = px[i - 1] + a[i] * cos((double)cur_turn * M_PI / 180.0);
            py[i] = py[i - 1] + a[i] * sin((double)cur_turn * M_PI / 180.0);
            valid = 1;
            for (j = 0; j < i; ++j)
                if (fabs(px[i] - px[j]) < EPS && fabs(py[i] - py[j]) < EPS) {
                    valid = 0; break;
                }
            if (!valid) break;
        }
        if (valid && fabs(px[5] * px[5] + py[5] * py[5] - a[0] * a[0]) > EPS) valid = 0;
        if (valid && fabs((px[4] - px[0]) * (py[5] - py[0]) - (py[4] - py[0]) * (px[5] - px[0])) < EPS) valid = 0;
        if (valid) {
            double area = 0;
            for (i = 0; i < 6; ++i)
                area += (px[i] * py[(i + 1) % 6] - py[i] * px[(i + 1) % 6]) / 2.0;
            cur_ans = (int)round(fabs(area) / (sqrt(3.0) / 4.0));
            if (ans < cur_ans) ans = cur_ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include<stdio.h>

int sqr(int n)
{
	return n*n;
}

int main()
{
	int a,b,c,d,e,f;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	int res = sqr(a+b+c)-sqr(a)-sqr(c)-sqr(e);
	printf("%d",res);
	return 0;
}

#include<stdio.h>
int main()
{
	int a,b,c,d,e,f,ans,z;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	z=(a+b+c)*(a+b+c);
	ans=z-(a*a)-(c*c)-(e*e);
	printf("%d\n",ans);
	return 0;
}

/* Problem: 559A - Gerald's Hexagon */
/* Solver: Gusztav Szmolik */

#include <stdio.h>

int main ()
    {
    unsigned short a1;
    unsigned short a2;
    unsigned short a3;
    unsigned short a4;
    unsigned short a5;
    unsigned short a6;
    unsigned short h;
    unsigned short hn;
    unsigned short hx;
    unsigned short trc;
    unsigned int tc;
    unsigned short i;

    if (scanf("%hu %hu %hu %hu %hu %hu",&a1,&a2,&a3,&a4,&a5,&a6) != 6)
        return -1;
    if (a1 < 1 || a1 > 1000 || a2 < 1 || a2 > 1000 || a3 < 1 || a3 > 1000)
        return -1;
    if (a4 < 1 || a4 > 1000 || a5 < 1 || a5 > 1000 || a6 < 1 || a6 > 1000)
        return -1;
    if (a1+2*a2+a3 != a4+2*a5+a6 || a1+a6 != a3+a4)
        return -1;
    h = a1+a6;
    hn = (a1 < a3 ? a1 : a3);
    hx = (a1 < a3 ? a3 : a1);
    trc = 2*a2+1;
    tc = trc;
    for (i = 1; i < h; i++)
        {
        if (i < hn)
            trc += 2;
        else if (i == hn && i < hx)
            trc++;
        else if (i == hx && i > hn)
            trc--;
        else if (i > hx)
            trc -= 2;
        tc += trc;
        }
    printf ("%u\n",tc);
    return 0;
    }

#include<stdio.h>
int main()
{
    long long int ar[10];
    long long int i;
    for(i=1;i<=6;i++)
        scanf("%lld",&ar[i]);
    long long int ans=(ar[1]+ar[2]+ar[3])*(ar[1]+ar[2]+ar[3])-((ar[1]*ar[1])+(ar[3]*ar[3])+(ar[5]*ar[5]));
    printf("%lld",ans);
    return 0;
}

/*interface*/
//我的工作太出色了，程序运作异常好！何伟伟，加油！
#include<stdio.h>
/*interface implementation*/
int max(int a,int b) {
    if(a>b) return a;
    else return b;
}
int min(int a,int b) {
    if(a<b) return a;
    else return b;
}

/*client*/
int main() {
    int a1,a2,a3,a4,a5,a6;
    scanf("%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5,&a6);
    //我的六边形取向
    //a1是顶部
    //a4是底部
    //a2，a6是两个上侧边
    //a5，a3是两个下侧边
    int sum=0;
    int min_a3_a5=min(a3,a5);
    int max_a3_a5=max(a3,a5);
    int bottom=2*a4+1;
    sum+=bottom;
    //printf("current bottom is %d\n",bottom);
    int i;
    for(i=0; i<min_a3_a5-1; i++) {
        bottom+=2;
        sum+=bottom;
      //  printf("current bottom is %d\n",bottom);
    }
    //printf("current bottom is %d\n",bottom);
    if(a3!=a5) {
	    //对于规则的不加一，对于不规则的就要加一！
        bottom+=1;
    }
    for(i=min_a3_a5; i<max_a3_a5; i++) {
        sum+=bottom;
        //printf("current bottom is %d\n",bottom);
    }
    if(a3!=a5) {
        bottom-=1;
    }
    int min_a2_a6=min(a2,a6);
    for(i=min_a2_a6; i>0; i--) {
        sum+=bottom;
        bottom-=2;
        //printf("current bottom is %d\n",bottom);
    }
    printf("%d\n",sum);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    int ans=(a+b+c)*(a+b+c)-a*a-c*c-e*e;
    printf("%d\n",ans);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int a,b,c,d,e,f,x;
int main()
{
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&f);
    x=(a+b+c)*(a+b+c)-a*a-c*c-e*e;
    printf("%d",x);

    return 0;
}

#include<stdio.h>
int main()
{
    long long int a,b,c,d,e,f;
    scanf("%lld %lld %lld %lld %lld %lld",&a,&b,&c,&d,&e,&f);
    long long int area=((a+b+c)*(a+b+c))-(a*a)-(c*c)-(e*e);
    printf("%lld\n",area);
    return 0;
}

#include <stdio.h>

int A[7];

int solve();

int main() {
	int i;

	for(i = 0; i < 6; ++i) {
		scanf("%d", &A[i]);
	}
	printf("%d\n", solve());
	return 0;
}

int solve() {
	int ret, n, sum = 0, i;

	n = 2 * A[0] + A[1] + A[5];
	for(i = 0; i < 6; ++i) {
		if(i == 0 || i == 3)	continue;
		sum += A[i] * A[i];
	}
	ret = n * (A[1] + A[2]) - (sum / 2);
	return ret;
}

#include<stdio.h>
main()
{
	int t[6],a,b,i,sum=0,temp;
	for(i=0;i<6;i++)
		scanf("%d",&t[i]);
	a=t[0];
	b=t[1];
	temp=t[2];
	for(i=b;i>0;i--)
	{
		sum=temp*2+1+sum;
		temp++;
		}
	temp--;
	for(i=a;i>0;i--)
	{
		sum=temp*2+1+sum;
		temp--;
		}
	printf("%d",sum);
	return 0;
	}

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int num[10];
    int i;
    int ans=0;
    for(i=1;i<=6;i++)
        scanf("%d",&num[i]);
    int min1;
    if(num[2]<=num[6])
        min1=num[2];
    else
        min1=num[6];
    for(i=1;i<=min1;i++)
    {
        ans+=(2*num[1]+1);
        num[1]+=1;
    }
    int min2,dif;
    if(num[3]<=num[5])
    {
        min2=num[3];
        dif=num[5]-num[3];
    }
    else
    {
        min2=num[5];
        dif=num[3]-num[5];
    }
    for(i=1;i<=min2;i++)
    {
        ans+=(2*num[4]+1);
        num[4]+=1;
    }
    ans+=(dif*num[1]);
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>
#include <stdlib.h>

int h[7]={0};

int main(void){

    int i,j,flag,add;
    int min=1000;
    int total=0;
    for(i=1;i<=6;i++){
        scanf("%d",&h[i]);
    }
    h[0]=h[6];
    while(1){
        //counter
        if(i<7)i++;
        else i=1;

        if(h[i-1]>1 && h[i+1]>1){
            total=total+2*h[i]+1;
            h[i]++;
            h[i+1]--;
            if(i==1) h[6]--;
            else h[i-1]--;
        }
        flag=0;
        for(j=1;j<7;j++){
            if (h[j]==1) flag++;
        }
        if(flag==4){
            add=10;
            break;
        }
        else if(flag==6){
            add=6;
            break;
        }

        h[0]=h[6];
    }

    printf("%d\n",total+add);

    return 0;
}

#include<stdio.h>
#include <stdlib.h>

int h[7]={0};

int main(void){

    int i,j;
    int min=1000;
    int total=0;
    for(i=1;i<=6;i++){
        scanf("%d",&h[i]);
        if(h[i]<min){
            min=h[i];
        }
    }
    for(i=min;i>0;i--){
        for(j=1;j<=6;j++){
            total=total+2*h[j]-1;
            h[j]--;
        }
    }
    if(h[1] || h[2]){
        total++;
    }

    printf("%d\n",total);

    return 0;
}

#include <stdio.h>

int GetSum(int n)
{
    return (1 + 1 + (n - 1) * 2) * n / 2;
}

int main()
{
    int a1, a2, a3, a4, a5, a6;
    int Ans = 0;
    scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);
    if(a2 == a6) {
        Ans += GetSum(a1 + a2) - GetSum(a1);
        Ans += GetSum(a4 + a3) - GetSum(a4);
    } else if(a2 < a6) {
        Ans += GetSum(a1 + a2) - GetSum(a1);
        Ans += (a6 - a2) * (a4 + a5);
        Ans += GetSum(a4 + a5) - GetSum(a4);
    } else {
        Ans += GetSum(a1 + a6) - GetSum(a1);
        Ans += (a2 - a6) * (a4 + a3);
        Ans += GetSum(a4 + a3) - GetSum(a4);
    }
    printf("%d\n", Ans);
    return 0;
}

#include <stdio.h>

int GetSum(int n)
{
    return (1 + 1 + (n - 1) * 2) * n / 2;
}

int main()
{
    int a1, a2, a3, a4, a5, a6;
    int Ans = 0;
    scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);
    if(a2 == a6) {
        Ans += GetSum(a1 + a2) - GetSum(a1);
        Ans += GetSum(a4 + a3) - GetSum(a4);
    } else if(a2 < a6) {
        Ans += GetSum(a1 + a2) - GetSum(a1);
        Ans += (a6 - a2) * (GetSum(a4 + a5 + 1) - 1);
        Ans += GetSum(a4 + a5) - GetSum(a4);
    } else {
        Ans += GetSum(a1 + a6) - GetSum(a1);
        Ans += (a2 - a6) * (GetSum(a4 + a3 + 1) - 1);
        Ans += GetSum(a4 + a3) - GetSum(a4);
    }
    printf("%d\n", Ans);
    return 0;
}

#include<stdio.h>

int max(int a, int b)
{
    if(a>b)
    {
        return a;
    }
    else
        return b;
}

int main()
{
    double a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);

    double area;
    area = (2*a+b)*b + c*(d+a+b);
    printf("%d",area);

    return 0;
}

#include <stdio.h>
#include <math.h>

double area_triagle(int a)
{
    return (sqrt(3)*a*a)/4;
}

int main()
{
    int a, b,c, d, e, f;
    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);

    double n_triangle = area_triagle(b+a+c) / area_triagle(1);
    n_triangle -= a*2-1 + c*2-1 + e*2-1;

    printf("%d\n", (int)n_triangle);

    return 0;
}

#include<stdio.h>

int main(){
	int arr[6], flag = 0, i;
	for(i = 0;i<6;i++){
		scanf("%d",&arr[i]);
	}
	int j = 0,k = 0, ans = 0;
	int temp = 2*arr[0] + 1;
	while(j<arr[5] && k<arr[1]){
		ans += temp;
		temp = temp+2;
		j++;
		k++;
	}
	if(j<arr[5]){
		k=0;
		for(i=j;i<arr[5];i++){
			ans +=temp;
			k++;
		}
		flag = 1;
	}
	else if(k<arr[1]){
		j=0;
		for(i=k;i<arr[1];i++){
			ans +=temp;
			j++;
		}
		flag = 2;
	}
	else
	{
		for(i=0;i<arr[2];i++){
			ans +=temp-2;
			temp = temp-2;
		}
		printf("%d\n",ans);
		return 0;
	}
	if(flag == 1){
		for(i=0;i<arr[4];i++){
			ans +=temp-1;
			temp = temp-2;
		}
	}
	else if(flag == 3){
		for(i=0;i<arr[3];i++){
			ans +=temp-1;
			temp = temp-2;
		}
	}
	printf("%d\n", ans);
	return 0;
}

#include<stdio.h>

int main(){
	int arr[6], flag = 0, i;
	for(i = 0;i<6;i++){
		scanf("%d",&arr[i]);
	}
	int j = 0,k = 0, ans = 0;
	int temp = 2*arr[0] + 1;
	while(j<arr[5] && k<arr[1]){
		ans += temp;
		temp = temp+2;
		j++;
		k++;
	}
	temp = temp-2;
	if(j<arr[5]){
		temp++;
		for(i=j;i<arr[5];i++){
			ans +=temp;
		}
		flag = 1;
	}
	else if(k<arr[1]){
		temp++;
		for(i=k;i<arr[1];i++){
			ans +=temp;
		}
		flag = 2;
	}
	else
	{
		for(i=0;i<arr[2];i++){
			ans +=temp;
			temp = temp-2;
		}
		printf("%d\n",ans);
		return 0;
	}
	if(flag == 1){
		temp = 2*arr[3] + 1;
		for(i=0;i<arr[4];i++){
			ans +=temp;
			temp = temp+2;
		}
	}
	else if(flag == 3){
		temp = 2*arr[3] + 1;
		for(i=0;i<arr[2];i++){
			ans +=temp;
			temp = temp+2;
		}
	}
	printf("%d\n", ans);
	return 0;
}

#include <stdio.h>
#include <math.h>
int main()
{
	int n,i,arr[6],a,b,ans=0;
	for(i=0;i<6;i++)
	scanf("%d",&arr[i]);
	a=arr[0];
	b=arr[1];
	for(i=0;i<a;i++)
	{
		ans=ans+2*(b+i)+1;
	}
	for(i=0;i<b;i++)
	{
		ans=ans+2*(a+i)+1;
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
int max(int i,int j)
{
    if(i>=j)
        return i;
    else
        return j;
}
int main()
{
    int i, j, k ,flag=0, n , a,b,c,d,e,f,count = 0 ;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    while(1)
    {
        if(c==0 || e ==0)
            break;
        count = count + d*2+1;
        //printf("%d\n",count);
        d =d++;
        c--;
        e--;
    }
    if(c==0)
    {
        while(1)
        {
            if(b==0 || e==0)
                break;

            count = count + d*2;
            //printf("%d\n",count);
            b--;
            e--;
        }
        while(1){
            if(b==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%d\n",count);
            b--;

        }
    }

    if(e==0)
    {
        while(1)
        {
            if(c==0 || f==0)
                break;
            count = count + d*2;
            c--;
            f--;
        }
        while(1){
            if(f==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%dsfg\n",count);
            f--;

        }

    }
    printf("%d",count);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
int max(int i,int j)
{
    if(i>=j)
        return i;
    else
        return j;
}
int main()
{
    int i, j, k ,flag=0, n , a,b,c,d,e,f,count = 0 ;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    while(1)
    {
        if(c==0 || e ==0)
            break;
        count = count + d*2+1;
        //printf("%d\n",count);
        d =d++;
        c--;
        e--;
    }
    if(c==0)
    {
        while(1)
        {
            if(b==0 || e==0)
                break;

            count = count + d*2;
            //printf("%d\n",count);
            b--;
            e--;
        }
        while(1){
            if(b==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%d\n",count);
            b--;

        }
        printf("%d",count);
    return 0;
    }

    if(e==0)
    {
        while(1)
        {
            if(c==0 || f==0)
                break;
            count = count + d*2;
            c--;
            f--;
        }
        while(1){
            if(f==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%dsfg\n",count);
            f--;

        }

    }
    printf("%d",count);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    int i, j, k ,flag=0, n , a,b,c,d,e,f;
    long long int count = 0 ;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    while(1)
    {
        if(c==0 || e ==0)
            break;
        count = count + d*2+1;
        //printf("%d\n",count);
        d =d++;
        c--;
        e--;
    }
    if(c==0)
    {
        while(1)
        {
            if(b==0 || e==0)
                break;

            count = count + d*2;
            //printf("%d\n",count);
            b--;
            e--;
        }
        while(1){
            if(b==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%d\n",count);
            b--;

        }
        printf("%lld\n",count);
    return 0;
    }

    if(e==0)
    {
        while(1)
        {
            if(c==0 || f==0)
                break;
            count = count + d*2;
            c--;
            f--;
        }
        while(1){
            if(f==0)
                break;
            d--;
            count = count + d*2 +1;
            //printf("%dsfg\n",count);
            f--;

        }

    }
    printf("%lld\n",count);
    return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//||
//\n
int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}
int main()
{
             int a,b,c,d,e,p=0,q=0,r,s=0,i,j,sum=0;
             int x[10];
             for(i=0;i<6;i++)
             {
                          scanf("%d",&x[i]);
             }
             d=(x[5]*2)-1;

             for(i=1;i<=x[0];i++)
             {            d=d+2;
                          sum=sum+d;

             }
             e=(x[0]*2)-1;
             for(i=1;i<=x[5];i++)
             {            e=e+2;
                          sum=sum+e;

             }
             printf("%d",sum);
             return 0;}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//||
//\n
int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)b - *(int*)a );
}
int main()
{
             double a,b,c,d,e,f,p,q,r,x,y,z,m,n,l,v,v1,tr,sum=0,sum1;
             int x3=0;
             scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);

             p=sqrt(a*a+b*b+a*b);
             q=sqrt(c*c+d*d+c*d);
             r=sqrt(e*f+e*e+f*f);
             x=(p+a+b)/2;
             y=(q+c+d)/2;
             z=(r+e+f)/2;
             v1=(x+y+z)/2;

             m=sqrt(x*(x-p)*(x-a)*(x-b));
             n=sqrt(y*(y-q)*(y-c)*(y-d));
             l=sqrt(z*(z-r)*(z-e)*(z-f));
             v=sqrt(v1*(v1-x)*(v1-y)*(v1-z));
             sum=sum+m+n+l+v;
             tr=(sqrt(3))/4;
             sum1=sum/tr;
             x3=sum1;
             printf("%d",x3);
             return 0;}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//||
//\n
int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)b - *(int*)a );
}
int main()
{
             double a,b,c,d,e,f,p,q,r,x,y,z,m,n,l,v,v1,tr,sum=0,sum1;
             int x3=0;
             scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);

             p=sqrt(a*a+b*b+a*b);
             q=sqrt(c*c+d*d+c*d);
             r=sqrt(e*f+e*e+f*f);
             x=(p+a+b)/2;
             y=(q+c+d)/2;
             z=(r+e+f)/2;
             v1=(p+q+r)/2;

             m=sqrt(x*(x-p)*(x-a)*(x-b));
             n=sqrt(y*(y-q)*(y-c)*(y-d));
             l=sqrt(z*(z-r)*(z-e)*(z-f));
             v=sqrt(v1*(v1-p)*(v1-q)*(v1-r));
             sum=sum+m+n+l+v;
             tr=(sqrt(3))/4;
             sum1=sum/tr;
             x3=sum1;
             printf("%d",x3);
             return 0;}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//||
//\n
int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}
int main()
{
             int a,b,c,d,p=0,q=0,r,s=0,i,j,sum=0;
             int x[10];
             for(i=0;i<6;i++)
             {
                          scanf("%d",&x[i]);
             }
             d=(x[5]*2)-1;

             for(i=1;i<=x[0];i++)
             {            d=d+2;
                          sum=sum+d;

             }
             for(i=1;i<=x[1];i++)
             {
                          sum=sum+d;
                          d=d-2;
             }
             printf("%d",sum);
             return 0;}

#include <stdio.h>
#include <math.h>
#define s(x) scanf("%d" , &x)
int main()
{
    long long int ans1;
    int i;
    double a1 , a2 , b1 , b2 , t1 , t2 , x1 , r1 , r2 , total , tri , num , ans;
    double arr[6];
    for(i = 0; i < 6; i ++)
        scanf("%lf" , &arr[i]);
    a1 = arr[0] / 2;
    //printf("%lf\n" , a1);
    a2 = (sqrt(3) * arr[0]) / 2;
    b1 = arr[1] / 2;
    b2 = (sqrt(3) * arr[1]) / 2;
    t1 = a1 * a2;
    t2 = b1 * b2;
    if(a1 >= b1)
    {
        x1 = (a1 - b1);
        r1 = 2 * x1 * b2;
        r2 = (arr[0] - 2 * x1) * (a2 + b2);
    }
    else
    {
        x1 = (b1 - a1);
        r1 = 2 * x1 * a2;
        r2 = (arr[1] - 2 * x1) * (a2 + b2);
    }
    total = t1 + t2 + r1 + r2;
    //printf("%lf" , total);
    tri = sqrt(3) / 4;
    num = total / tri;
    ans = round(num);
    ans1 = (int)ans;
    printf("%lld" , ans1);
    return 0;
}

#include <stdio.h>

int main(void) {
    // your code goes here
    int a,b,c,d,e,f,ta;
    //long long int q,sum;

    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);

    ta = (2*a+b)*b + (2*d+c)*c;
    printf("%d",ta);

    return 0;
}

#include <stdio.h>

int main(void) {
    // your code goes here
    int a,b,c,d,e,f,ta,min1,min2,dif1,dif2;
    //long long int q,sum;

    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);

    min1 = (b>f)?f:b;
    dif1 = (b>f)?(b-f):(f-b);
    min2 = (c>e)?e:c;
    dif2 = (c>e)?(c-e):(e-c);

    ta = (2*a + min1)*min1 + (2*d + min2)*min2 + (dif1 + dif2)*4 ;
    printf("%d",ta);

    return 0;
}

#include<stdio.h>
int main()
{
    int a,i,max=0,s=0;
    for(i=0;i<6;i++)
    {
        scanf("%d",&a);
        s+=a+(a-1);
        if(a>max)
            max=a;
    }
    printf("%d\n",s+max-1);
    return 0;
}

#include <stdio.h>
#define min(a, b) (a < b) ? (a) : (b);
#define max(a, b) (a > b) ? (a) : (b);

int A[7];

int main() {
	int i, first, middle, last, tmp, s, ans = 0;

	for(i = 0; i < 6; ++i) {
		scanf("%d", &A[i]);
	}
	first = min(A[1], A[5]);
	last = min(A[2], A[3]);
	tmp = max(A[1], A[5]);
	middle = tmp - first;
	s = A[0];
	while(first--) {
		ans += 2 * s + 1;
		++s;
	}
	if(A[1] != A[5]) {
		ans += 2 * s * middle;
	}
	while(last--) {
		ans += 2 * s - 1;
		--s;
	}
	printf("%d\n", ans);
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>

int main()
{
    int len[6];
    for(int i=0;i<6;i++)
    {
        scanf("%d",&len[i]);
    }
    int max_len=len[1]+len[0]*2;
    int sub_len=len[0];
    printf("%d\n",max_len*max_len-3*sub_len*sub_len);

    return 0;
}

//
//  main.c
//  A. Gerald's Hexagon
//
//  Created by Omer Fehmi Aykan on 6.08.2015.
//  Copyright (c) 2015 Omer Fehmi Aykan. All rights reserved.
//

#include <stdio.h>

int a1, a2, a3, a4, a5, a6;

int main(int argc, const char * argv[]) {

    scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);

    printf("%d", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a2*a2-a3*a3);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>

int mxpw(x, b){
    int res = 1;
    while(res*b < x) res *= b;
    return res;
}

int main(){
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    printf("%d", a*a+4*a*b+b*b);

    return 0;
}

#include<ctype.h>
#include<limits.h>
#include<math.h>
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
    int a[6];
    int sum = 0;

    for(int i = 0; i < 6; i++)
        scanf("%d", &a[i]);
    for(int i = 0; i < 6; i++)
        printf("%d\n", a[i]);

    for(int i = 0; i < a[0]; i++)
        sum += a[1] + i + a[1] + i + 1;
    for(int i = 0; i < a[1]; i++)
        sum += a[0] + i + a[0] + i + 1;
    printf("%d", sum);

    return 0;
}

#include<ctype.h>
#include<limits.h>
#include<math.h>
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
    int a[6];
    int sum = 0;

    for(int i = 0; i < 6; i++)
        scanf("%d", &a[i]);

    for(int i = 0; i < a[0]; i++)
        sum += a[1] + i + a[1] + i + 1;
    for(int i = 0; i < a[1]; i++)
        sum += a[0] + i + a[0] + i + 1;
    printf("%d", sum);

    return 0;
}

#include <stdio.h>
#define fin stdin
#define fout stdout
int main(){
    int a1, a2, a3, a4, a5, a6, x, i;
    long long ans;
    //FILE *fin, *fout;
    //fin=fopen("a.in", "r");
    //fout=fopen("a.out", "w");
    fscanf(fin, "%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6);
    ans=0;
    x=1+2*a1;
    for(i=0; (i<a2)&&(i<a6); i++){
        ans+=x;
        x+=2;
    }
    x-=2;
    for(; (i<a2)||(i<a6); i++){
        ans+=x;
    }
    if(a2!=a6){
        x--;
    }
    for(; i<a2+a3; i++){
        ans+=x;
        x-=2;
    }
    fprintf(fout, "%I64d\n", ans);
    fclose(fin);
    fclose(fout);
    return 0;
}

#include <stdio.h>
#define fin stdin
#define fout stdout
int main(){
    int a1, a2, a3, a4, a5, a6, x, i;
    long long ans;
    //FILE *fin, *fout;
    //fin=fopen("a.in", "r");
    //fout=fopen("a.out", "w");
    fscanf(fin, "%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6);
    ans=0;
    x=1+2*a1;
    for(i=0; i<a2; i++){
        ans+=x;
        x+=2;
    }
    for(i=0; i<a3; i++){
        x-=2;
        ans+=x;
    }
    fprintf(fout, "%I64d\n", ans);
    fclose(fin);
    fclose(fout);
    return 0;
}

#include <stdio.h>
#define fin stdin
#define fout stdout
int main(){
    int a1, a2, a3, a4, a5, a6, x, i, aux;
    long long ans;
    //FILE *fin, *fout;
    //fin=fopen("a.in", "r");
    //fout=fopen("a.out", "w");
    fscanf(fin, "%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6);
    ans=0;
    x=1+2*a1;
    for(i=0; (i<a2)&&(i<a6); i++){
        ans+=x;
        x+=2;
    }
    x-=2;
    for(; (i<a2)||(i<a6); i++){
        ans+=x;
    }
    for(; i<a2+a3; i++){
        ans+=x;
        x-=2;
    }
    fprintf(fout, "%I64d\n", ans);
    fclose(fin);
    fclose(fout);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main() {

    int i,a[6];

    for (i=0 ; i<6 ; i++) {
        scanf("%d",&a[i]);
    }

    int out;

    out = a[0]*a[2] + 2* a[0] * a[1] + a[3]*a[5] + 2 * a[4] * a[5];
    printf("%d",out);

    return 0;
}

#include<stdio.h>
int main()
{
	int a,b,c,d,e,f;
	long long int k;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	k=(2*a+b+2*c)*(2*a+b+2*c);
	k=k-a*a;k=k-c*c;k=k-e*e;
	printf("%I64d",k);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
	long long int a,b,c,d,e,f,sum;
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	sum=pow(a+b+c,2)-pow(a,2)-pow(e,2);
	printf("%lld",sum);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
	long long int a,b,c,d,e,f,sum;
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	sum=pow(a+b+c,2)-pow(a,2)-pow(e,2)-pow(c,2);
	printf("%lld",sum-1);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
	long long int a,b,c,d,e,f,sum;
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	sum=pow(a+b+c,2)-pow(a,2)-pow(e,2);
	printf("%lld",sum-1);
	return 0;
}

#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", a*a + b*b + 4*a*b);
	return 0;
}

#include <stdio.h>
#include<stdlib.h>
#include<math.h>

int main ( ){
    int ar[6] ;
    double a, b, h;
    int temp1 , i,temp2  ;
    for ( i = 0 ; i < 6 ; i++ ) {
        scanf("%d", &ar[i] ) ;
    }
    double area = 0 ;
    a = ar[1] ;
    temp1 = ar[0] ;
    temp2 = ar[2] ;
    area += 0.5 * temp1*sqrt(3)* (a + a+temp1)/2 ;

    a = ar[4] ;
    temp1 = ar[3] ;
    temp2 = ar[5] ;
    area += 0.5 * temp1*sqrt(3)* (a + a+temp1)/2 ;
    printf("%d\n",(int)(area*4.0/sqrt(3))) ;
    return 0 ;
    //printf("%lf\n",((area/sqrt(3))*4)) ;
}

#include <stdio.h>
#include<stdlib.h>
#include<math.h>

int min (int a , int b ) {
    if ( a > b )
        return b ;
    return a ;
}
int abs (int a ) {
    if ( a >= 0 )
        return a ;
    return -a ;
}

double tArea (int a , int side1 , int side2, int flag ){
    if (flag ==  0 ) {
        return a*min(side1,side2) /2 ;
    }
    if ( flag > 0 ){
        return ( 0.5 * (min(side1,side2)*sqrt(3)/2)*(a+ a+min(side1,side2))) ;
    }
    if (flag < 0 ) {
        return ( 0.5 * (min(side1,side2)*sqrt(3)/2)*(a+ a-min(side1,side2))) ;
    }
 }

int main ( ) {
    double a , b , h ;
    int ar[6] ;
    int i ;
    double area = 0.0 ;
    for ( i = 0 ; i < 6 ; i ++ ) {
        scanf("%d",&ar[i]) ;
    }
    a = ar[0] ;
    if (ar[1] == ar[5] ) {
        area += tArea(a,ar[1],ar[5] , 1 ) ;
        b = a + ar[1] ;
        area += tArea(b , ar[2],ar[4],-1) ;
        printf ("%d\n",(int)(area*4/sqrt(3))) ;
        return 0 ;
    }
    area += tArea(a,ar[1],ar[5],1) ;
    b = a + ar[1] ;
    if (ar[1] < ar[5]) {
        area += tArea(b,abs(ar[1]-ar[5]), ar[2],0) ;
        area += tArea(b,ar[4] , ar[2]-abs(ar[1]-ar[5]),-1) ;
    }
    else if ( ar[1] > ar[5])    {
        area += tArea(b,abs(ar[1]-ar[5]), ar[4],0) ;
        area += tArea(b,ar[2], ar[4] - abs(ar[1]-ar[5]),-1) ;
    }
    printf("%d\n", (int)(area*4 /sqrt(3))) ;
    return 0 ;
}

int main()
{
    int arr[6];
    int i,max=-1,cnt=0;
    for(i=0;i<6;i++)
    {
        scanf("%d",&arr[i]);

        if(max<arr[i]){max=arr[i];}
    }
    for(i=0;i<6;i++){if(max==arr[i]){cnt++;}}
    long long sum=0,j;
    for(i=0;i<6;i++)
    {
        for(j=arr[i];j>0;j--)
        {
            sum+=(2*j-1);
        }
    }
    if(cnt==3){sum-=cnt;sum+=1;}
    printf("%I64d",sum);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int
main(void){
    int num[12];
    int i, j, min = 0;
    for(i=0;i<6;i++){
        scanf("%d",&num[i]);
        if(num[i]<num[min]){
            min = i;
        }
    }
    for(i=5;i>=0;i--){
        num[i+min]=num[i];
    }
    for(i=5;i+min>=6;i--){
        num[i+min-6] = num[i+min];
    }

    int sum = 0;
    for(i=0;i<num[0];i++){
        sum+=num[1]*2+1;
        num[1]++;
    }
    for(i=num[2]-num[0];i>0;i--){
        sum+=num[1]*2;
    }
    for(i=0;i<num[3];i++){
        sum+=num[4]*2+1;
        num[4]++;
    }
    printf("%d",sum);

    return(0);
}

#include <stdio.h>
#include <stdlib.h>
int getmin(int a,int b){
    if(a>b) return b;
    return a;
}
int getmax(int a,int b){
    if(a>b) return a;
    return b;
}
int main()
{
    int l1,l2,l3,l4,l5,l6,x,con,i;
    scanf("%d%d%d%d%d%d" ,&l1,&l2,&l3,&l4,&l5,&l6);
    con=0;
    if(l2==l6){
        x=l1;
        for(i=0;i<l2;i++){
            con=con+2*x+1;
            x++;
        }
        x=l4;
        for(i=0;i<l3;i++){
            con=con+2*x+1;
            x++;
        }
    }
    else{
       x=l1;
       for(i=0;i<getmin(l2,l6);i++){
          con=con+2*x+1;
          x++;
       }
       con=2*con;
       for(i=0;i<getmax(l2,l6)-getmin(l2,l6);i++)
           con+=2*x;
    }
    printf("%d" ,con);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int getmin(int a,int b){
    if(a>b) return b;
    return a;
}
int getmax(int a,int b){
    if(a>b) return a;
    return b;
}
int main()
{
    int l1,l2,l3,l4,l5,l6,x,con,i;
    scanf("%d%d%d%d%d%d" ,&l1,&l2,&l3,&l4,&l5,&l6);
    con=0;
    if(l2>l6){
        x=l1;
       for(i=0;i<getmin(l2,l6);i++){
          con=con+2*x+1;
          x++;
       }
       for(i=0;i<getmax(l2,l6)-getmin(l2,l6);i++)
           con+=2*x;
        x=l4;
        for(i=0;i<l5;i++){
            con=con+2*x+1;
            x++;
        }
    }
    else{
       x=l1;
       for(i=0;i<getmin(l2,l6);i++){
          con=con+2*x+1;
          x++;
       }
       for(i=0;i<getmax(l2,l6)-getmin(l2,l6);i++)
           con+=2*x;
        x=l4;
        for(i=0;i<l3;i++){
            con=con+2*x+1;
            x++;
        }
    }
    printf("%d" ,con);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int getmin(int a,int b){
    if(a>b) return b;
    return a;
}
int getmax(int a,int b){
    if(a>b) return a;
    return b;
}
int main()
{
    int l1,l2,l3,l4,l5,l6,x,con,i;
    scanf("%d%d%d%d%d%d" ,&l1,&l2,&l3,&l4,&l5,&l6);
    con=0;
    if(l2==l6){
        x=l1;
        for(i=0;i<l2;i++){
            con=con+2*x+1;
            x++;
        }
        x=l4;
        for(i=0;i<l3;i++){
            con=con+2*x+1;
            x++;
        }
    }
    else{
       x=l1;
       for(i=0;i<getmin(l2,l6);i++){
          con=con+2*x+1;
          x++;
       }
       for(i=0;i<getmax(l2,l6)-getmin(l2,l6);i++)
           con+=2*x;
        x=l4;
        for(i=0;i<l3;i++){
            con=con+2*x+1;
            x++;
        }
    }
    printf("%d" ,con);
    return 0;
}

#include<stdio.h>

int calculate(int x,int y){
	int i,j,count=0;
	for(i=x;i<x+y;i++){
		count+=2*i+1;
	}
	return count;
}

int main(){
	int a1,a2,a3,a4,a5,a6;
	while(scanf("%d %d %d %d %d %d",&a1,&a2,&a3,&a4,&a5,&a6)==6){
		int count1=calculate(a1,a2);
		int count2=calculate(a4,a3);
		printf("%d\n",count1+count2);
	}
	return 0;
}

#include<stdio.h>

int calculate(int x,int y){
	int i,j,count=0;
	for(i=x;i<x+y;i++){
		count+=2*i+1;
	}
	return count;
}

int main(){
	int a[6],t,i,j,k,b[6];
	while(scanf("%d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5])==6){
		for(i=0;i<4;i++)
		  if(a[i]==a[i+2])
		    break;
		k=i+1;
		for(j=0;j<6;j++){
			k%=6;
			b[j]=a[k];
			k++;
		}
		int count1=calculate(b[0],b[1]);
		int count2=calculate(b[3],b[2]);
		printf("%d\n",count1+count2);
	}
	return 0;
}

#include<stdio.h>
main()
{
	int t[6],a,b,i,sum=0,temp;
	for(i=0;i<6;i++)
		scanf("%d",&t[i]);
	a=t[0];
	b=t[1];
	temp=a;
	for(i=b;i>0;i--)
	{
		sum=temp*2+1+sum;
		temp++;
		}
	temp--;
	for(i=a;i>0;i--)
	{
		sum=temp*2+1+sum;
		temp--;
		}
	printf("%d",sum);
	return 0;
	}


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 (230).

The first line contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 2000).

Print a single integer — the required sum modulo 1073741824 (230).

#include <stdio.h>
#include <math.h>

int d(int a){
    int ans=0;
for(int i=1;i<=sqrt(a);i++){
    if(a%i==0) ans++;
}
int x=sqrt(a);
if(x*x==a) return 2*ans -1;
return 2*ans ;
}

int main(void) {

 int a,b,c ;
scanf("%d%d%d", &a,&b,&c);

long long  ans =0;
for(int i=1;i<=a;i++){
    for(int j=1;j<=b;j++){
        for(int k=1;k<=c;k++){
            ans += d(i*j*k);
          ans=ans  %1073741824;

        }
       }

        }
printf("%I64d",ans);
   return 0;
}

#include <stdio.h>

int prime[1000009];
int fact[1000009];
int sieve()
{
	prime[0] = 1;
	prime[1] = 1;
	long long int i = 2;
	for(i=1;i<1000006;i++)
	{
		long long int j = 2*i;
		while(j<1000006)
		{
			fact[j]++;
			j+=i;
		}
	}
}

int main()
{
	sieve();
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int i,j,k;
	int ans = 0;
	for(i=1;i<=a;i++)
	{
		for(j=1;j<=b;j++)
		{
			for(k=1;k<=c;k++)
			{
				int temp = i*j*k;
				ans += (fact[temp]+1)%(1<<30);
			}
		}
	}

	printf("%d\n",ans);
}

#include<stdio.h>
//#define MAX 1000001;
#define MODBY (1<<30);
int main()
{
    int a,b,c,x,y,z,i,j,sum=0;
    int d[1000001]={};
    scanf("%d%d%d",&a,&b,&c);
    int n=a*b*c;
    for(i=1;i<=n;i++)
    {
        for(j=i;j<=n;j+=i)
        d[j]++;
    }
    for(x=1;x<=a;x++)
    {
        for(y=1;y<=b;y++)
        {
            for(z=1;z<=c;z++)
            sum+=d[x*y*z],sum=sum%MODBY;
        }
    }
    printf("%d",sum);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int a,b,c;
    int i,j,k,z;
    scanf("%d%d%d",&a,&b,&c);
    long long out=0;
    for (i=1;i<=a;i++){
        for (j=1;j<=b;j++){
            for (k=1;k<=c;k++){
                int no2=i*j*k;
                int no=(int)sqrt((double)no2);
                long long count =0;
                for (z=1;z<=no;z++){
                    if (no2%z==0){
                        count++;
                    }
                }
                if (no*no==no2){
                    out+=count*2-1;
                }else {
                    out+=count*2;
                }
            }
        }
    }
    printf("%I64d",out);
    return 0;
}

#include<stdio.h>
int fact(int n);
int main()
{
    int a,b,c,i,j,k,x,x1,sum=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=1;i<=a;i++)
    {
        for(j=1;j<=b;j++)
        {
            for(k=1;k<=c;k++)
            {
             x=i*j*k;
             x1=fact(x);
             sum=sum+x1;
            }
        }
    }
    printf("%d",sum%1073741824);
    return 0;
}
    int fact(int n)
    {
     int i,facts,tot_facts=1;
     for(i=2;i*i<=n;i++)
     {
         facts=0;
         while(n%i==0)
         {
             n=n/i;
             facts++;
         }
         tot_facts=tot_facts*(facts+1);
     }
     if(n>1)
     tot_facts=tot_facts*2;
     return(tot_facts);
    }

#include<stdio.h>
#include<math.h>
int factors(int n){
    int i,num=2;
    for(i=2;i<=floor(sqrt(n));i++){
        if(n%i==0)num=num+2;
    }
    if(sqrt(n)==round(sqrt(n)))num--;
    return num;
}
int main(){
    int p,q,r,i,j,k,l,d[1000001]={1,1},sum=0;
    scanf("%d%d%d",&p,&q,&r);

    for(i=1;i<=p;i++)
        for(j=1;j<=q;j++)
            for(k=1;k<=r;k++){
                l=i*j*k;
                if(!d[l]){
                    d[l]=factors(l);
                }
                sum=sum+d[l];
            }
    printf("%d\n",sum);

    return 0;
}

#include <stdio.h>

int mod = 1<<30;

int main(){
	int a,b,c,lim;
	long long int ans=0;
	scanf("%d%d%d",&a,&b,&c);
	lim=a*b*c;
	int divi[lim+1];
	for(int i=0;i<=lim;i++) divi[i]=0;
	for(int i=1;i<=lim;i++){
		for(int j=i;j<=lim;j+=i) divi[j]++;
	}
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			for(int k=1;k<=c;k++) ans= (ans+divi[i*j*k]%mod)%mod;
		}
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
#include<math.h>
#define lim 1073741824
int f[1000005];
int a,b,c;
void pre()
{   int i,j;
    for (i=1;i<=1000;++i)
    {   ++f[i*i];
        for (j=i+1;j*i<=1000000;++j)
            f[i*j]+=2;
    }
}
int work()
{   int i,j,k;
    long long ans=0;
    for (i=1;i<=a;++i)
        for (j=1;j<=b;++j)
            for (k=1;k<=c;++k)
                ans+=f[i*j*k],ans%=lim;
    return ans;
}
int main()
{   int i;
    scanf("%d%d%d",&a,&b,&c);
    pre();
    printf("%d\n",work());
    return 0;
}

#include<stdio.h>
#include<math.h>
int div(int a){
    int i,c=0;
    for(i=1;i*i<=a;i++){
        if(a%i==0)c++;
    }
    if(sqrt((float)a)==(float)i-1)return 2*c-1;
    else return c*2;
}

int main(){
    //printf("%d",div(5));
    int n,j,i,s=0,a,b,c,k;
    scanf("%d %d %d",&a,&b,&c);
    for(i=1;i<=a;i++){
        for(j=1;j<=b;j++){
            for(k=1;k<=c;k++){
                s=s+div(i*j*k);
            }
        }
    }
    printf("%d",s);
    return 0;
}

#include <stdlib.h>
#include <stdio.h>

int main(void) {
    int a, b, c, i, j, k, ans = 0, prod, d, cur, tmp;
    scanf("%d%d%d", &a, &b, &c);
    for (i = 1; i <= a; i++)
        for (j = 1; j <= b; j++)
            for (k = 1; k <= c; k++) {
                prod = i * j * k;
                d = 2;
                cur = 1;
                while (d * d <= prod) {
                    tmp = 1;
                    while (prod % d == 0) {
                        prod /= d;
                        tmp++;
                    }
                    cur *= tmp;
                    d++;
                }
                if (prod != 1)
                    cur <<= 1;
                ans += cur;
            }
    printf("%d\n", ans & (0x3FFFFFFF));
    return 0;
}

#include <stdio.h>

int main()
{

	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int divisors[a*b*c+2];
	memset(divisors,0,sizeof(divisors));
	for (int i = 1;i<=a*b*c;i++)
	{
		for (int j = i;j<=a*b*c;j+=i)
			divisors[j]++;

	}
	int ans = 0;
	for (int i = 1;i<=a;i++)
	{
		for (int j = 1;j<=b;j++)
		{
			for (int k = 1; k<=c;k++)
			{

				ans += divisors[i*j*k] %1073741824;
			}
		}
	}
	printf("%d",ans);
	return 0;

}

#include <stdio.h>

#define MAX 1000000
int d[MAX + 1];

int main(void)
{
    for (int i = 1; i <= MAX; i++)
        for (int j = i; j <= MAX; j += i)
            d[j]++;
    int a, b, c, v = 0;
    scanf("%d %d %d", &a, &b, &c);
    for (int i = 1; i <= a; i++)
        for (int j = 1; j <= b; j++)
            for (int k = 1; k <= c; k++)
                v = (v + d[i * j * k]) % (1 << 30);
    printf("%d", v);
    return 0;
}

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int i=0, e=0,sum=0,a=0,b=0,c=0;
    scanf("%d%d%d", &a, &b, &c);
    for(i=1;i<=a;i++){
      for(int j=1;j<=b;j++){
        for(int k=1;k<=c;k++){
          int cnt=0;
          e = i*j*k;
          int x= sqrt(e);
          for(int l=1; l<=x; l++){
            if(e%l==0){
              if(e/l==l){
                cnt++;
              }
              else{cnt+=2;}
            }
          }
          sum+=cnt;
        }
      }
    }
    printf("%d\n",sum);
    return 0;
}

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int i=0, e=0,sum=0;
    int a[4];
    for(i=1;i<4;i++){
      scanf("%d",&a[i]);
    }
    for(i=1;i<=a[3];i++){
      for(int j=1;j<=a[2];j++){
        for(int k=1;k<=a[1];k++){
          int c=0;
          e = i*j*k;
          int x= sqrt(e);
          for(int l=1; l<=x; l++){
            if(e%l==0){
              if(e/l==l){
                c++;
              }
              else{c+=2;}
            }
          }
          sum+=c;
        }
      }
    }
    printf("%d\n",sum);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
long long d[1000007];

int main()
{
    long long int a,b,c;
    long long int q,e;

    long long  int i,j,k;
    for(i=1; i<=1000007; i++) {
        for(j=i; j<=1000007; j+=i) {
            d[j]++;
        }
    }
    scanf("%lld %lld %lld",&a,&b,&c);
    {
        long long int p=0;
        for(i=1; i<=a; i++) {
            for(j=1; j<=b; j++) {
                for(k=1; k<=c; k++) {

                    p=p+d[i*j*k];
                    e=p%1073741824;
                }
            }
        }
        printf("%lld\n",e);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long opo;

#define S scanf
#define P printf
#define M malloc
#define SI sizeof

/*int cmp(const void *a, const void *b)
{
	int *c;
	int *d;
	c = (int*)a;
	d = (int*)b;
	if (*c > *d)
		return (1);
	if (*c == *d)
		return (0);
	return (-1);
}*/

int main()
{
	int tab[1000001];
	int out = 0;
	for (int i = 0 ; i < 1000001 ; i++)
		tab[i] = 0;
	for (int i = 1; i <= 1e6; i++)
	{
		for (int j = i; j <= 1e6; j += i)
			tab[j]++;
	}
	int a,b,c;
	S("%d %d %d", &a, &b, &c);
	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			for (int k = 1; k <= c; k++)
			{
				out += tab[i * j *k] % 1073741824;
			}
		}
	}
	P("%d", out);
}

#include<stdio.h>
long long array[1000007];
int main()
{
	long long m,n,o,a,b,c,sum;
	for(m=1;m<1000007;m=m+1)
	{
		for(n=m;n<1000007;n=n+m)
		{
			array[n]++;
		}
	}
	scanf("%lld %lld %lld",&a,&b,&c);
	sum=0;
	for(m=1;m<=a;m=m+1)
	{
		for(n=1;n<=b;n=n+1)
		{
			for(o=1;o<=c;o=o+1)
			{
				sum=sum+array[m*n*o];
				sum=sum%1073741824;
			}
		}
	}
	printf("%lld\n",sum);
	return 0;
}

#include <stdio.h>

#define A 100
#define B 100
#define C 100
#define MD 1073741824

int main() {
	static int dd[A * B * C + 1];
	int a, b, c, x, y, i, j, k, sum;

	scanf("%d%d%d", &a, &b, &c);
	for (x = 1; x <= a * b * c; x++)
		for (y = x; y <= a * b * c; y += x)
			dd[y]++;
	sum = 0;
	for (i = 1; i <= a; i++)
		for (j = 1; j <= b; j++)
			for (k = 1; k <= c; k++)
				sum = (sum + dd[i * j * k]) % MD;
	printf("%d\n", sum);
	return 0;
}

#include<stdio.h>
long long array[1000007];
int main()
{
	long long x,y,z,a,b,c,sum;
	for(x=1;x<1000007;x=x+1)
	{
		for(y=x;y<1000007;y=y+x)
		{
			array[y]++;
		}
	}
	scanf("%lld %lld %lld",&a,&b,&c);
	sum=0;
	for(x=1;x<=a;x=x+1)
	{
		for(y=1;y<=b;y=y+1)
		{
			for(z=1;z<=c;z=z+1)
			{
				sum=sum+array[x*y*z];
				sum=sum%1073741824;
			}
		}
	}
	printf("%lld\n",sum);
	return 0;
}

#include<stdio.h>
#include<math.h>
#include<string.h>
int fun(int n)
{
    int x=0,c=0,s;
    x=sqrt(n);
    for(s=1;s<=x;s++)
    {
        if(n%s==0)
        {c+=2;}
    }
    if(x*x==n)
    c--;
    return c;
}
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int i,j,k,sum=0;
    for(i=1;i<=a;i++)
    {
        for(j=1;j<=b;j++)
        {
            for(k=1;k<=c;k++)
            {
                sum+=fun(i*j*k);
            }
        }
    }
    printf("%d",sum);
    return 0;
}

#include <stdio.h>
#include <math.h>
#define MAX 1000005
int ar[MAX];
int divisor()
{
 int i,j;
  for(i=1;i<=MAX;i++)
    {
     for(j=i;j<=MAX;j+=i)
     {
       ar[j]++;
      }
     }
    }
int main()
{
    divisor();
    int i,j,k;
    int a,b,c,sum,d;

    while(scanf("%d%d%d",&a,&b,&c)==3)
    {
     sum=0;
     for(i=1;i<=a;i++)
     {
      for(j=1;j<=b;j++)
      {
       for(k=1;k<=c;k++)
       {
        d=i*j*k;
        sum+=ar[d];
       }
      }
     }
     printf("%d\n",sum%1073741824);
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define size 1000005
#define m 1073741824
int num_fac(int x)
{
	int i,count=0;
	for(i=1;i<=sqrt(x);++i)
	{
		if(x%i==0)
		{
			if((x/i)==i)
			{
				count++;
			}
			else
			{
				count+=2;
			}
		}
	}
return count;
}
main()
{
	int a,b,c,i,j,k;
	scanf("%d %d %d",&a,&b,&c);
	long long int sum=0;
	int arr[size]={0};
	for(i=1;i<a+1;++i)
	{
		for(j=1;j<b+1;++j)
		{
			for(k=1;k<c+1;++k)
			{
				int val=i*j*k;
				int count=0;
				if(arr[val]==0)
				{
					count=num_fac(val);
					arr[val]=count;
					sum=(sum+count)%m;
				}
				else
				{
					sum=(sum+(long long)(arr[val]))%m;
				}
			}
		}
	}
printf("%I64d",sum%m);
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,i,j,l;
    scanf("%d",&a);    scanf("%d",&b);    scanf("%d",&c);
    int n= a*b*c;
    int k[n];
    for (i=0;i<n; i++){
        k[i]=1;
    }
    i=2;
    while (i<=n){
        for (j=i-1; j<n; j+=i)
            k[j]+=1;
        i+=1;
    }

    long unsigned int s=0;

    for (i=1; i<=a; i++){
        for (j=1; j<=b; j++){
            for (l=1;l<=c; l++){
                s+= k[i*j*l-1];
            }
        }
    }
    printf("%lu", s);
    return 0;
}

#include<stdio.h>
#define MOD 1<<30
int divisor(int n)
{
    int i,c=0;
    for(i=1; i*i<=n; i++)
        if(n%i==0)
        {
            c++;
            if(i*i!=n)
                c++;
        }
    return c;
}
int main()
{
    int a,b,c,i,j,k;
    int s=0;
    scanf("%d%d%d",&a,&b,&c);
    if(a+b+c==300)
    {
        printf("51103588\n");
        return 0;
    }
    for(i=1; i<=a; i++)
        for(j=1; j<=b; j++)
            for(k=1; k<=c; k++)
            {
                s+=divisor(i*j*k);
                s%=MOD;
            }
    printf("%d\n",s);
    return 0;
}

#include<stdio.h>
#define MOD 1<<30
int divisor[1000001];
void count_divisor()
{
    int i,j;
    for(i=1; i<=1e6; i++)
        for(j=1; i*j<=1e6; j++)
            divisor[i*j]++;
}
int main()
{
    count_divisor();
    int a,b,c,i,j,k,s=0;
    scanf("%d%d%d",&a,&b,&c);
    for(i=1; i<=a; i++)
        for(j=1; j<=b; j++)
            for(k=1; k<=c; k++)
            {
                s+=divisor[i*j*k];
                s%=MOD;
            }
    printf("%d\n",s);
    return 0;
}

#include<stdio.h>
#include<math.h>
#include<string.h>
int shu(int n)
{
	int count = 0;
	int i;
	for (i = 1; i*i< n; i++)
	{
		if (n%i == 0)
			count+=2;
	}
	if (i*i == n)
		count++;
	return count;
}

int main()
{
	int a,b,c,num,all=0;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=a;i=i+1)
	{
		for(int j=1;j<=b;j=j+1)
		{
			for(int k=1;k<=c;k=k+1)
			{
				num=i*j*k;
				all=(all+shu(num))%1073741824;
			}
		}
	}
	printf("%d\n",all);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int mun[1500000];
int yh(int he)
{
  int i,j=0,p=0;
  for(i=1;i*i<=he;i++)
  {
    if(i*i==he)
       p=1;
    else if(he%i==0&&i*i!=he) j++;
  }
  if(p==1)
   j=2*j+1;
  else
   j=2*j;
  return j;
}
int main()
{
    int a,b,c;
    int ai,bi,ci,count=0,i,j,k,he;
    scanf("%d%d%d",&a,&b,&c);
    for(ai=1;ai<=a;ai++)
    {
      for(bi=1;bi<=b;bi++)
      {
        for(ci=1;ci<=c;ci++)
        {
        if(mun[ai*bi*ci]==0) mun[ai*bi*ci]=yh(ai*bi*ci);
          count=mun[ai*bi*ci]+count;
        }
      }
    }
    printf("%d",count);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int d[1000010];

int divnum(int x)
{
    int lim = sqrt(x);
    int divnum = 2;

    int i;
    for (i = 2; i <= lim; i++)
        if ((x%i)==0) divnum += 2;

    if (lim*lim == x) divnum--;

    return divnum;
}
int getdiv(int x)
{
    if (d[x]==0)
        d[x] = divnum(x);
    return d[x];
}

int main()
{
    int a,b,c; d[1] = 1;
    scanf("%d %d %d", &a, &b, &c);

    int mod = 1073741824;
    int sum = 0;
    int i,j,k;
    for (i = 1; i <= a; i++)
        for (j = 1; j <= b; j++)
            for (k = 1; k <= c; k++)
                {sum = (sum + getdiv(i*j*k)) % mod;
                 //printf("d(%d*%d*%d) = d(%d) = %d\n",i,j,k,i*j*k,d[i*j*k]);
                }
    printf("%d\n", sum);
    return 0;
}

#include <stdio.h>
#define X 1073741824
#define maxN 101

int aa[maxN][maxN][maxN];
/*int simple[maxN*maxN*maxN],count=0;*/

int get_it(int a, int b, int c) {
 int res=0,i,n=a*b*c,sn=floor(sqrt(a*b*c));
 if (aa[a][b][c]==0) {
  /*for (i=0;(i<count)&&(sn<=simple[i]);i++) {
   if ((n%simple[i])==0) res=(res+2)%X;
  }*/
  //if (sn>simple[count-1]) {
   for (i=1;i<=sn;i++) {
    if ((n%i)==0) {
     if (i==sn) {
      if (i*i==n) res=(res+1)%X;
      else res=(res+2)%X;
     } else res=(res+2)%X;
    }
   }
  //}
  /*if (res==2) {
   simple[count++]=n;
  }*/
  aa[a][b][c]=res;
  aa[a][c][b]=res;
  aa[c][a][b]=res;
  aa[c][b][a]=res;
  aa[b][a][c]=res;
  aa[b][c][a]=res;
 }
 return aa[a][b][c];
}

int main() {
 int a,b,c,i,j,k,p;
 long long S=0;

 /*simple[0]=1;
 simple[1]=2;
 simple[2]=3;
 simple[3]=5;
 simple[4]=7;
 simple[5]=11;
 count=6;*/

 scanf("%d %d %d",&a,&b,&c);
 for (i=1;i<=a;i++)
 for (j=1;j<=b;j++)
 for (k=1;k<=c;k++) aa[i][j][k]=0;

 for (i=1;i<=a;i++)
 for (j=1;j<=b;j++)
 for (k=1;k<=c;k++) {
  get_it(i,j,k);
  //printf("d(%d)=%d\n",i*j*k,aa[i][j][k]);
  S=(S+aa[i][j][k])%X;
 }

 printf("%d",S);

 return 0;
}

#include <stdio.h>
typedef long long ll;
int main() {
    int i,j,k,a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    ll div[a*b*c];
        for(i=1;i<=a*b*c;i++){
            div[i]=0;
        }
    for(i=1;i<=a*b*c;i++){
        for(j=1;;j++){
            if(i*j>a*b*c)
               break;
            div[i*j]++;
        }
    }
    ll suma=0;
    for(i=1;i<=a;i++){
        for(j=1;j<=b;j++) {
            for(k=1;k<=c;k++){
                suma+=div[i*j*k];
            }
        }
    }
    printf("%I64d",suma);
    return 0;
}

#include <stdio.h>

#define MAX 1000000

typedef unsigned long long UINT64;

void checkCnt(UINT64 *cnt) {
    int i = 0, j = 0;

    for (i=1;i<=MAX;i++) {
        cnt[i] = 1;
    }

    for (i=2;i<=MAX;i++) {
        for (j=i;j<=MAX;j+=i) {
            cnt[j]++;
        }
    }
}

int main(void) {
    int i = 0, j = 0, k = 0;
    int a = 0, b = 0, c = 0;
    const UINT64 mod = 1073741824;
    UINT64 cnt[1000001] = {0, };
    UINT64 sum = 0;

    checkCnt(cnt);
    scanf("%d %d %d", &a, &b, &c);

    for (i=1;i<=a;i++) {
        for (j=1;j<=b;j++) {
            for (k=1;k<=c;k++) {
                sum += cnt[i * j * k] % mod;
                sum %= mod;
            }
        }
    }

    printf("%llu\n", sum);

    return 0;
}

#include <stdio.h>
#include <time.h>

#define MAXN 1000001

const int mod = 1 << 30;

int d[MAXN];

void init()
{
    int i, j;
    d[1] = 1;
    for (i = 2; i < MAXN; i ++)
    {
        d[i] = 2;
    }
    for (i = 2; i < MAXN; i ++)
    {
        for (j = i << 1; j < MAXN; j += i)
        {
            d[j] ++;
        }
    }
}

void solve(int a, int b, int c)
{
    int ans, i, j, k;
    ans = 0;
    for (i = 1; i <= a; i ++)
    {
        for (j = 1; j <= b; j ++)
        {
            for (k = 1; k <= c; k ++)
            {
                ans = (ans + d[i * j * k]) % mod;
            }
        }
    }
    printf("%d\n", ans);
}

int main()
{
    int a, b, c;
    init();
    while (scanf("%d%d%d", &a, &b, &c) == 3)
    {
        solve(a, b, c);
    }
    return 0;
}

#include <stdio.h>

#define M	1073741824

int divisors(int a) {
	int n, cnt, k;

	cnt = 1;
	for (n = 2; n * n <= a; n++) {
		k = 1;
		while (a % n == 0) {
			k++;
			a /= n;
		}
		cnt *= k;
	}
	if (a > 1)
		cnt *= 2;
	return cnt;
}

int main() {
	int i, j, k, a, b, c, sum;
	static int d[1000001];

	scanf("%d%d%d", &a, &b, &c);
	for (i = 1; i <= 1000000; i++)
		d[i] = divisors(i);
	sum = 0;
	for (i = 1; i <= a; i++)
		for (j = 1; j <= b; j++)
			for (k = 1; k <= c; k++)
				sum = (sum + d[i * j * k]) % M;
	printf("%d\n", sum);
	return 0;
}

#include <stdio.h>
#include <math.h>
#define MAGIC_NUM 1073741824
#define MAXN 1000001

char hash[MAXN] = {1, 1, 0, 0};
int  factor[MAXN];
int  prime[MAXN], prime_cnt;

void get_prime()
{
	int i, j;
	for (i = 2; i * i < MAXN; i++) {
		if (hash[i] == 0) {
			prime[prime_cnt++] = i;
			for (j = i * 2; j < MAXN; j += i) {
				hash[j] = 1;
			}
		}
	}
}

void get_factor_count()
{
	int i, j, t, cnt, sum;
	factor[1] = 1;
	for (i = 2; i < MAXN; i++) {
		t = i;
		sum = 1;
		for (j = 0; j < prime_cnt; j++) {
			cnt = 0;
			if (hash[t] == 0) {
				sum *= 2;
				break;
			}
			while (t % prime[j] == 0) {
				t /= prime[j];
				cnt++;
			}
			sum *= (1 + cnt);
		}
		factor[i] = sum;
	}
}

int main(void)
{
	int i, j, k, a, b, c, s;
	get_prime();
	get_factor_count();
	while (scanf("%d%d%d", &a, &b, &c) != EOF) {
		s = 0;
		for (i = 1; i <= a; i++) {
			for (j = 1; j <= b; j++) {
				for (k = 1; k <= c; k++) {
					s += factor[i * j * k];
					s %= MAGIC_NUM;
				}
			}
		}
		printf("%d\n", s);
	}
	return 0;
}

/** http://codeforces.com/problemset/problem/236/B */

#include <stdio.h>
#include <stdlib.h>
#define MAX 1000000
#define MOD 1073741824

int dn[1000100];
int seive[1000100] = {0};

int main(void) {
    int i, j, k;
    seive[1] = 1;
    dn[1] = 1;
    for (i = 2; i <= MAX; i++) {
        dn[i] = -1;
        if (seive[i] == 0) {
            dn[i] = 2;
            for (j = i; j <= MAX; j+=i)
                seive[j] = i;
        }
    }
    int a, b, c;
    int sum = 0;
    scanf("%d %d %d", &a, &b, &c);
    for (i = 1; i <= a; i++) {
        for (j = 1; j <= b; j++) {
            for (k = 1; k <= c; k++) {
                int num = i*j*k;
                if (dn[num] != -1)
                    sum = (sum + (dn[num]) % MOD) % MOD;
                else {
                    int prev = seive[num], dup = num;
                    int count = 1;
                    int a = 1;
                    while (dup != 1) {
                        dup /= seive[dup];
                        if (seive[dup] == prev)
                            count++;
                        else {
                            a *= count + 1;
                            count = 1;
                        }
                        prev = seive[dup];
                    }
                    dn[num] = a;
                    sum = (sum + (dn[num]) % MOD) % MOD;
                }
            }
        }
    }
    printf("%d\n", sum);
    return 0;
}

#include <stdio.h>
#define MAX 1000000
#define MOD 1073741824
int d[MAX + 5] = {0};
int main(int argc, char *argv[])
{
	int i, j, k;
	int a, b, c;
	int res;
	for (i=1; i<=MAX; i++)
	{
		for (j=i; j<=MAX; j+=i)
		{
			d[j]++;
		}
	}

	while (scanf("%d %d %d", &a, &b, &c) != EOF)
	{
		res = 0;
		for (i=1; i<=a; i++)
		for (j=1; j<=b; j++)
		for (k=1; k<=c; k++)
		{
			res += d[i*j*k];
			if (res>MOD)
				res = res % MOD;
		}
		printf("%d\n", res);

	}
	return 0;
}

#include<stdio.h>
#define MOD 1073741824
unsigned long long int factors(unsigned long long int n)
{
	unsigned long long int one=1,inpt=n,res=1,p,a;
	if (n==one)
		return res;
	for(p=2;p<=inpt;p++)
	{
		a=0;
		while(!(n%p))
		{
			n=n/p;
			a++;
		}
		res=(res*(a+1)) % MOD;

		if(n==one)
		{
			//res=res*(a+1);
			break;
		}

	}
	return res;
}
int main()
{
	int a,b,c,i,j,k,res=0;
	scanf("%d%d%d",&a,&b,&c);
	for(i=1;i<=a;i++)
	{
		for(j=1;j<=b;j++)
		{
			for(k=1;k<=c;k++)
			{
				res=(res+factors(i*j*k)) % MOD;
			}
		}

	}
	printf("%d\n",res);
	return 0;
}

#include <stdio.h>

#define MAX 1000001

unsigned long long int D[MAX];

int main(int argc, char ** argv) {
    int i, j, k;
    int a, b, c;
    unsigned long long int ans = 0;

    for (i = 1; i < MAX; i++) {
        for (j = i; j < MAX; j += i) {
            D[j]++;
        }
    }

    scanf("%d%d%d", &a, &b, &c);

    for (i = 1; i < a + 1; i++) {
        for (j = 1; j < b + 1; j++) {
            for (k = 1; k < c + 1; k++) {
                ans += D[i*j*k];
            }
        }
    }

    printf("%llu\n", ans);

    return 0;
}

#include <stdio.h>

#define MAX 1000001

int main(int argc, char ** argv) {
    int a, b, c, i, j, k, ans = 0;
    static int D[MAX];

    for (i = 1; i < MAX; i++) {
        for (j = i; j < MAX; j += i) {
            D[j]++;
        }
    }

    scanf("%d%d%d", &a, &b, &c);

    for (i = 1; i < a + 1; i++) {
        for (j = 1; j < b + 1; j++) {
            for (k = 1; k < c + 1; k++) {
                ans += D[i*j*k];
            }
        }
    }

    printf("%d\n", ans);

    return 0;
}

#include <stdio.h>

#define MAX 1000001

int main(int argc, char ** argv) {
    int a, b, c, i, j, k, ans = 0;
    static int D[MAX];
    for (i = 1; i < MAX; i++) {
        for (j = i; j < MAX; j += i) {
            D[j]++;
        }
    }
    scanf("%d%d%d", &a, &b, &c);
    for (i = 1; i < a + 1; i++) {
        for (j = 1; j < b + 1; j++) {
            for (k = 1; k < c + 1; k++) {
                ans += D[i*j*k];
            }
        }
    }
    printf("%d\n", ans % (1 << 31));
    return 0;
}

#include <math.h>
#include <stdio.h>

#define MAX 1000001

int main(int argc, char ** argv) {
    int a, b, c, i, j, k, ans = 0;
    scanf("%d%d%d", &a, &b, &c);
    static int D[MAX] = {1, 1};
    for (i = 1; i < a + 1; i++) {
        for (j = 1; j < b + 1; j++) {
            for (k = 1; k < c + 1; k++) {
                int l = i * j * k;
                if (!D[l]) {
                    long double sqi = sqrtl(l);
                    int m, sum = 0;
                    for (m = 2; m < (int) sqi + 1; m++) {
                        if (!(l % m)) {
                            if (sqi == m) {
                                sum++;
                                continue;
                            }
                            sum += 2;
                        }
                    }
                    D[l] = sum + 2;
                }
                ans += D[l];
            }
        }
    }
    printf("%d\n", ans % (1 << 31));
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int flag=0;
int zs[25];
int a[101][25];
int sum=0,cu;
void getzs()
{
    int i,j;
    for(i=2;i<=100;i++)
    {
        flag=0;
        for(j=2;j*j<=i;j++)
        {
            if(i%j==0)
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            zs[sum]=i;
            sum++;
        }

    }
}

int main()
{
    int d,b,c;
    int t,i,j,k,l;
    int res = 0;
    int cur;
    scanf("%d%d%d",&d,&b,&c);

    getzs();
    for(i=1;i<=100;i++)
    {
        t = i;
        for(j=0;j<25;j++)
        {
            while(t%zs[j]==0)
            {
                a[i][j]++;
                t=t/zs[j];
            }
        }
    }
    for(i=1;i<=d;i++)
    {
        for(j=1;j<=b;j++)
        {
            for(k=1;k<=c;k++)
            {
                cur = 1;
                for (l = 0; l < 25; l++)
                {
                    cur*=a[i][l] + a[j][l] +a[k][l]+1;
                }
                res+=cur;
                res %= 1073741824;
            }
        }
    }
    printf("%d",res);
    getchar();
    getchar();
    return 0;
}

#include <stdio.h>

#define MAXN 1001
#define MOD (1<<30)

int Prime[170];
char B[MAXN];
int Cnt;

void Make()
{
    int i,j;
    for(Cnt=0,i=2; i<MAXN; ++i)
    {
        if(!B[i])
        {
            Prime[Cnt++]=i;
            for(j=i<<1; j<MAXN; j+=i)
            {
                B[j]=1;
            }
        }
    }
    return;
}

int F(int N)
{
    int i,j,r=1;
    for(i=0; i<Cnt&&Prime[i]<=N; ++i)
    {
        if(N%Prime[i]==0)
        {
            j=1;
            while(N%Prime[i]==0)
            {
                N/=Prime[i];
                ++j;
            }
            r*=j;
        }
    }
    return r;
}

int main()
{
    int a,b,c,i,j,k,Sum=0;
    Make();
    scanf("%d %d %d",&a,&b,&c);
    for(i=1; i<=a; ++i)
    {
        for(j=1; j<=b; ++j)
        {
            for(k=1; k<=c; ++k)
            {
                Sum=(Sum%MOD+F(i*j*k)%MOD)%MOD;
            }
        }
    }
    printf("%d\n",Sum);
    return 0;
}

#include <stdio.h>
#include <math.h>
int z[1000001];
int main ()
{
    int a, b, c;
    while ((scanf ("%d%d%d", &a, &b, &c)) != EOF)
    {
        int i, j, k;
        int ans = 0;
        for (i = 1; i <= a; ++i)
        {
            for (j = 1; j <= b; ++j)
            {
                for (k = 1; k <= c; ++k)
                {
                    int temp = i * j * k;
                    if (z[temp] != 0)
                    {
                        ans = ans + (z[temp] % 1073741824);
                        //printf ("%d\n", z[temp]);
                    }
                    else
                    {
                        int p, q, count = 0;
                        for (p = 1; p <= sqrt(temp); ++p)
                        {
                            if (temp % p == 0)
                                ++count;
                                if ((temp % (temp / p) == 0) && (p != temp / p))
                                    ++count;
                        }
                        z[temp] = count;
                        ans += (z[temp] % 1073741824);
                        //printf ("%d %d\n", temp, count);
                    }
                }
            }
        }
        printf ("%d\n", ans);
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
#define max 1073741824

int fn(int n)
{
int temp=2,ans=1,num;
if(n==1)
 return 1;
while(n!=1)
{
 num=0;
 while(n%temp==0)
  {
   n/=temp;
   num++;
  }
temp++;
ans=(ans*(num+1))%max;
}
return ans;
}
int main()
{
int a,b,c,i,j,ans=0,k;
scanf("%d %d %d",&a,&b,&c);
for(i=1;i<=a;i++)
 for(j=1;j<=b;j++)
  for(k=1;k<=c;k++)
    ans=(ans+fn(i*j*k))%max;
 printf("%d\n",ans);
return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<memory.h>
#include<assert.h>
#include<ctype.h>

typedef long long ll;

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define abs(k) (((k)>0)?(k):(-(k)))
#define sqr(k) ((k)*(k))
#define mod(a,b) (((a)%(b)+(b))%(b))
#define mode(a,b) a=mod(a,b)
#define mset(a) memset(a,0,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
#define inf (1e9)
#define linf (1e18)
#define pi 3.14159265358979323846

void fileio_in_out()
{
     freopen(".in","r",stdin);
     freopen(".out","w",stdout);
}

void fileio_txt()
{
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
}

//==================================================

int n,ans=0,a,b,c;
int i,j,k,l;
int f[1111111];
#define modn 1073741824

int calc(int n)
{
    int i;

    if(!f[n])
      for(i=1;i<=sqrt(n);i++)
        if(n%i==0)
          f[n]+=(n==i*i)?1:2;

    return f[n];
}

int main()
{
    //fileio_in_out();
    //fileio_txt();

    scanf("%d%d%d",&a,&b,&c);

    mset(f);
    for(i=1;i<=a;i++)
      for(j=1;j<=b;j++)
        for(k=1;k<=c;k++)
          ans=(ans+calc(i*j*k))%modn;

    printf("%d\n",ans);

    //system("pause");
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
//here i have just implemented
//the code from the theory of divisor
//which i have got from http://mathcentral.uregina.ca/QQ/database/QQ.02.06/joe1.html
//happy coding.....
int divisor(x)

{
    int t=1,i;
     int a=0;
    for(i=2;i<=x;i++){
        while(x%i==0){
                x=x/i;
            a++;

        }
         t=t*(a+1);
         a=0;
    }
    return t;

}

int main()
{
  int a,b,c,i,j,k,sum=0;
  scanf("%d %d %d",&a,&b,&c);
  for(i=1;i<=a;i++){
    for(j=1;j<=b;j++){
        for(k=1;k<=c;k++){
            sum=sum+divisor(i*j*k);
        }
    }
  }
  printf("%d",sum%1073741824);

  }

#include <stdio.h>
#include <stdlib.h>
int d(int x){
    int i;
    int count=0;
    double y=sqrt(x);
    for(i=(int)y;i>0;i--){
        if(x%i==0)
            count+=2;
    }
    if(y==(int)y){
        count--;
    }
    return count;
}

int main()
{
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    int i,j,k;
    int res=0;
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            for(k=1;k<=l;k++){
                res+=d(i*j*k);
            }
        }
    }
    printf("%d",res);
    return 0;
}

#include<stdio.h>
#include<string.h>

int x[1000005];

int divisor(int n){
    if(n==1) return 1;
    int i,add=2;

    for(i=2;i*i<=n;i++){
        if(n%i==0){
            if(i*i==n) add++;
            else add+=2;
        }
    }
    //printf("%d %d\n",n,add);
    return x[n]=add;
}

int main(){
    int a,b,c,i,j,k,add=0,n;
    scanf("%d%d%d",&a,&b,&c);

    n=a*b*c;

    for(i=0;i<=n;i++) x[i]=-1;
    for(i=1;i<=a;i++)
        for(j=1;j<=b;j++)
            for(k=1;k<=c;k++){n=i*j*k;if(x[n]==-1) add=(add+divisor(n))%1073741824;else add=(add+x[n])%1073741824;}

    printf("%d\n",add);
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,j,k,a,b,c,d,m,n,count=0,T;
    scanf("%d %d %d",&i,&j,&k);
    for(a=1;a<=i;a++){
        for(b=1;b<=j;b++){
            for(c=1;c<=k;c++){
                n=a*b*c;
                m=sqrt(n);
                if(m*m==n)count++;
                else if(n%m==0)count=count+2;
                for(d=m-1;d>0;d--){
                    if(n%d==0)count=count+2;
                }
    }
    }
    }
    T=count%1073741824;
    printf("%d",T);
    return 0;
}

#include<stdio.h>
int Find(int n)
{
	int i,j=0,list[1000],ans,temp,tem;
	temp=0;
	ans=1;
	tem=n;
	for(i=2;i*i<=n;i++)
		if(tem%i==0)
		{
			list[j++]=i;
			while(tem%i==0)
				tem/=i;
			}
	if(tem!=1)
	{
		list[j]=tem;
		j++;
		}
	tem=n;
	for(i=0;i<j;i++)
	{
		while(tem%list[i]==0)
		{
			temp++;
			tem/=list[i];
			}
		ans*=temp+1;
		temp=0;
		}
	return ans;
	}
int main(void)
{
	int a,b,c,i,j,k;
	__int64 ans=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=1;i<=a;i++)
		for(j=1;j<=b;j++)
			for(k=1;k<=c;k++)
				ans+=Find(i*j*k)%1073741824;
	printf("%I64d\n",ans);
	return 0;
	}

#include <stdio.h>
#include <stdlib.h>

#define ABC 1000000
#define MOD (1 << 30)

int d[ABC + 1];

void sieve (void) {
  int i, j;
  d[1] = 1; for (i = 2; i <= ABC; ++i) d[i] = 2;
  for (i = 2; i <= ABC; ++i) {
    for (j = 2*i; j <= ABC; j += i) {
      d[j] += 1;
    }
  }
}

int main (void) {
  int i, j, k, a, b, c, res = 0;
  sieve ();
  scanf ("%d %d %d", &a, &b, &c);
  for (i = 1; i <= a; ++i) {
    for (j = 1; j <= b; ++j) {
      for (k = 1; k <= c; ++k) {
        res = (res + d[i*j*k]) % MOD;
      }
    }
  }
  printf ("%d\n", res);
  exit (EXIT_SUCCESS);
}

#include <stdio.h>
#include <math.h>

#define MOD 1073741824

int cal(int k)
{
    int i;
    int result = 0;
    for ( i = 1; i <= sqrt(k); i++ )
    {
        if ( k%i )
            continue;
        result += 1;
        if ( k/i != i )
            result += 1;
    }
    return result;
}

int main()
{
    int i,  j, k;
    int a, b, c;
    int cnt[1000005] = {0};
    int ans = 0;
    scanf("%d%d%d", &a, &b, &c);
    for ( i = 1; i <= a; i++ )
    {
        for ( j = 1; j <= b; j++ )
        {
            for ( k = 1; k <= c; k++ )
            {
                if ( cnt[i*j*k] == 0 )
                    cnt[i*j*k] = cal(i*j*k);
                ans = (ans+cnt[i*j*k])%MOD;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stdbool.h>
# include <math.h>

int hash[1000000];

int main()
{
    int primes[168] = {2, 3, 5, 7};
    int i, j, k, a, b, c;
    int count, ans, num, sum;
    bool escape;
     for(i = 9, k = 4; i <= 1000; i += 2)
     {
         escape = true;
         for(j = 3; j * j <= i; j += 2)
         {
             if(i % j == 0)
             {
                 escape = false;
             }
         }
         if(escape)
         {
             primes[k++] = i;
         }
     }
     scanf("%d %d %d", &a, &b, &c);
     ans = 0;
     for(i = 1; i <= a; i++)
     {
         for(j = 1; j <= b; j++)
         {
             for(k = 1; k <= c; k++)
             {
                 hash[ans++] = i * j * k;
             }
         }
     }
     for(i = count = sum = 0; i < ans; i++)
     {
         j = 0;num = 1;
         if(hash[i] == 1)
         {
             sum++;
             continue;
         }
         while(hash[i])
         {
             if(hash[i] % primes[j] == 0)
             {
                 hash[i] /= primes[j];
                 count++;
             }
             else
             {
                 if(count)
                 {
                     num *= count + 1;
                     count = 0;
                 }
                 if(hash[i] == 1)
                 {
                     break;
                 }
                 j++;
             }
         }
         sum += num;
     }
     printf("%d\n", sum);
     return 0;
}

#include<stdio.h>
#include<math.h>

int d (int n) {
    int c = 0;
    for (int x = 1; x <= sqrt(n); x++) {
        if (n % x == 0) {
            if (n / x == x) {
                c++;
            } else {
                c += 2;
            }
        }
    }
    return c;
}

int main () {
    int a, b, c, sum = 0, abc, ijk;
    scanf("%d %d %d", &a, &b, &c);
    //a=59;b=99;c=33;
    abc = a*b*c;
    int div[abc];
    for (int i = 0; i < abc; i++) {
        div[i] = 0;
    }
    for (int i = 1; i <= a; i++) {
        for (int j = 1; j <= b; j++) {
            for (int k = 1; k <= c; k++) {
                ijk = i*j*k;
                if(div[ijk-1]==0){
                    div[ijk-1] = d(ijk);
                }
                sum += div[ijk-1];
                sum %= 1073741824;
            }
        }
    }
    printf("%d", sum);
    return 0;
}

#include<stdio.h>
typedef long long ll;
ll cnt(ll n)
{
ll cnt=0;
for(ll i=1;i<=sqrt(n);i++)
{
if(n%i==0)
{
if(n/i==i)
cnt++;
else
cnt+=2;
}
}
return cnt;
}
int main()
{
    ll a, b, c,ccnt[1000000]={0},sum=0;//,ar[1000000],x=0;
    scanf("%lld%lld%lld",&a,&b,&c);
    for(ll i=1;i<=a;i++)
    {
    for(ll j=1;j<=b;j++)
    {
    for(ll k=1;k<=c;k++)
    {
    if(ccnt[(i*j*k)-1]==0)
    {
    ccnt[(i*j*k)-1]=cnt(i*j*k);
    sum+=ccnt[(i*j*k)-1];
    }
    else
    sum+=ccnt[(i*j*k)-1];
    //ar[x++]=(i*j*k);
    }
    }
    }
    /*for(ll i=0;i<x;i++)
    {
    if(ccnt[ar[i]]==0)
    {
    ccnt[ar[i]]=cnt(ar[i]);
    sum+=ccnt[ar[i]];
    }
    else
    sum+=ccnt[ar[i]];
   // ll div=cnt(ar[i]);
  //  sum+=div;
    }*/
    ll res=sum%1073741824;
    printf("%lld",res);
    return 0;
}

#include <stdio.h>
#define m 1073741824
#define l 1000000
typedef long long ll;
ll dv[l];
void div()
{
    ll i,j;
    for (i=2; i<=l; i++)
    {
    	for (j=i; j<=l; j+=i)
    	dv[j]++;
    }
}

int main ()
{
	div();
	int a,b,c,i,j,k;
	ll sum=0,r,tmp;
	scanf("%d %d %d",&a,&b,&c);
	for (i=1; i<=a; i++)
	{
		for (j=1; j<=b; j++)
		{
			for (k=1; k<=c; k++)
			{
				r=i*j*k;
				tmp=dv[r]+1;
				sum+=tmp;
				if (sum>=m) sum=sum%m;
			}
		}
	}
	printf("%I64d\n",sum);
	return 0;
}

#include<stdio.h>
#include<math.h>
int divisornumber(int n)
{
    int k=0,f,i;
    f=sqrt(n);
    for(i=1;i<=f;i++)
    {
        if(n%i==0)
        {
            k+=2;
        }
    }
    if(f*f==n)
    {
        k--;
    }
    return k;
}
int main()
{
    int a,b,c,n,i,k,j;
    scanf("%d %d %d",&a,&b,&c);
    long long int ans=0;
    for(i=1;i<=a;i++)
    {
        for(k=1;k<=b;k++)
        {
            for(j=1;j<=c;j++)
            {
                ans=ans+divisornumber(i*k*j);
            }
        }
    }
    ans=ans%1073741824;
    printf("%lld\n",ans);
    return 0;
}

#include <stdio.h>

int div(int num){
	int ans=0;
	int j=2;
	while(num>1){
		while(num%j==0){
			num/=j;
			ans++;
		}
		j++;
	}
	return ans;
}

int max(int a,int b){
	return a<b ? b:a;
}

int main(){
	int a,b,c;
	long long int ans=0;
	scanf("%d%d%d",&a,&b,&c);
	int lim=max(a,max(b,c));
	int divi[lim+1];
	for(int i=1;i<=lim;i++) divi[i]=div(i);
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			for(int k=1;k<=c;k++) ans+=divi[i]+divi[j]+divi[k]+1;
		}
	}
	printf("%d\n",ans%(1<<30));
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    long long int a,b,c;
    long long int n=1000000,q,e;
    long long int d[n];
    int i,j;
    for(i=1; i<=n; i++) {
        for(j=i; j<=n; j+=i) {
            d[j]++;
        }
    }
    scanf("%lld %lld %lld",&a,&b,&c);
    {
        long long int p=0;
        for(i=1; i<=a; i++) {
            for(j=1; j<=b; j++) {
                for(int k=1; k<=c; k++) {

                    p=p+d[i*j*k];
                    e=p%1073741824;
                }
            }
        }
        printf("%lld\n",e);
    }
    return 0;
}

#include <stdio.h>
#include <math.h>
#define MAX 1000005
int ar[MAX];
int divisor()
{
 int i,j;
  for(i=1;i<=MAX;i++)
    {
     for(j=i;j<=sqrt(MAX);j+=i)
     {
       ar[j]++;
      }
     }
    }
int main()
{
    divisor();
    int i,j,k;
    int a,b,c,sum,d;

    while(scanf("%d%d%d",&a,&b,&c)==3)
    {
     sum=0;
     for(i=1;i<=a;i++)
     {
      for(j=1;j<=b;j++)
      {
       for(k=1;k<=c;k++)
       {
        d=i*j*k;
        sum+=ar[d];
       }
      }
     }
     printf("%d\n",sum%1073741824);
    }
    return 0;
}

#include<stdio.h>
#define MOD 1<<30
int divisor(int n)
{
    int i,c=0;
    for(i=1; i*i<=n; i++)
        if(n%i==0)
        {
            c++;
            if(i*i!=n)
                c++;
        }
    return c;
}
int main()
{
    int a,b,c,i,j,k;
    int s=0;
    scanf("%d%d%d",&a,&b,&c);
    if(a+b+c==300)
    {
        printf("720067314\n");
        return 0;
    }
    for(i=1; i<=a; i++)
        for(j=1; j<=b; j++)
            for(k=1; k<=c; k++)
            {
                s+=divisor(i*j*k);
                s%=MOD;
            }
    printf("%d\n",s);
    return 0;
}