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:

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

ll modulo = 1e9 + 7;

int main()
{
  string s;
  ll a,b,c,d,e,f;
  ld ar1,ar2,ar3,ar4,an1,an2,h1,h2;
  cin>>a>>b>>c>>d>>e>>f;
  ar1=a*f*pow(3,0.5)/4;
  ar2=c*d*pow(3,0.5)/4;
  h1=pow(a*a+f*f+a*f,0.5);
  h2=pow(c*c+d*d+c*d,0.5);
  an1=asin(pow(3,0.5)*f/2/h1);
  an1=(2*M_PI/3)-an1;
  ar3=0.5*b*h1*sin(an1);

  an1=asin(pow(3,0.5)*c/2/h2);
  an1=(2*M_PI/3)-an1;
  ar4=0.5*e*h2*sin(an1);
  ar1=ar1+ar2+ar3+ar4;
  ar2=pow(3,0.5)/4;
  ar1=round(ar1/ar2);
  a=ar1;
  cout<<a<<endl;

	return 0;
}

#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld double
#define vi vector < int >
#define cd complex<double>
#define vpii vector < pii >
#define sz(x) int((x).size())
#define pii pair < int, int >
//#define piii pair < pii, int >
#define fenwick(x) ((x) & -(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << "[" << #x << "]: " << x << "\n";

using namespace std;

//CZY DANE POSORTOWANE, N = 0, N = 1, CZYTANIE TRESCI, < rosnaco, > malejaco

ll tab[6];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	for (int i = 0; i < 6; ++i)cin >> tab[i];

	cout << (tab[0] + tab[1] + tab[2])*(tab[0] + tab[1] + tab[2]) - tab[0] * tab[0] - tab[2] * tab[2] - tab[4] * tab[4];

	return 0;
}

#include<iostream>

using namespace std;

int main(){
    int a1,a2,a3,a4,a5,a6;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;
    int l=a1+a2+a3;
    int cantidad=l*l-a1*a1-a3*a3-a5*a5;
    cout<<cantidad;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int a[7];

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	for(int i=1;i<=6;i++)scanf("%d",a+i);
	int ans=0;
	ans=(a[3]+a[1]+a[2])*(a[3]+a[1]+a[2])-a[1]*a[1]-a[3]*a[3]-a[5]*a[5];
	cout<<ans<<endl;
	return 0;
}

# include<iostream>
# include <fstream>
# include<algorithm>
using namespace std;

int main()
{
    int res = 0;
    int mass[6];

    for (int i = 0; i < 6;i++)
    {
        cin >> mass[i];
    }

    for (int i = 1; i <= min(mass[1], mass[5]); i++)
    {
        res += 2 * mass[0] + 1;
        mass[0]++;
    }

    for (int i = 1; i <= min(mass[2], mass[4]); i++)
    {
        res += 2 * mass[3] + 1;
        mass[3]++;
    }

    res += 2 * mass[0]*abs((mass[2] - mass[4]));
    cout << res;
    return 0;

}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a[6];
    for (int i = 0; i < 6; i++) {
        cin >> a[i];
    }
    long long c = (pow((a[0] + a[1] + a[2]), 2) - pow(a[0], 2) - pow(a[2], 2)
            - pow(a[4], 2));
    cout << c << endl;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long ll;

ll a[6];

int main() {
    for (int i = 0; i < 6; i++)scanf("%lld", &a[i]);
    ll s = a[0] * 2 - 1;
    ll ans = 0;
    for (int i = 0; i < min(a[1], a[5]); i++) {
        s += 2;
        ans += s;
    }
    s = a[3] * 2 - 1;
    for (int i = 0; i < min(a[2], a[4]); i++) {
        s += 2;
        ans += s;
    }
    s++;
    for (int i = 0; i < max(a[2], a[4]) - min(a[2], a[4]); i++) {
        ans += s;
    }
    printf("%lld\n", ans);
    return 0;
}

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "cmath"
#include "utility"
#include "map"
#include "stack"
#include "queue"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define pb push_back
#define all(ar) ar.begin(),ar.end()

using namespace std;
using ll = long long;
using ld = long double;

ll ar[6],s1,s2,c1,c2,in,ans = 0;

bool chk(){
	if(c1 > 0 || c2 > 0) return false;
	if(s1 != s2  || s1 == 1 || s2 == 1) return false;
	return true;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for(int i = 0; i < 6; i++) cin>>ar[i];
	s1 = 1,s2 = 1,c1 = ar[1],c2 = ar[5],in = ar[0];
	while(1){
	//	cout<<c1 sp<<c2 sp<<in sp;
		if(chk()) break;
		if(s1 == s2){
			int nw;
			if(s1 == -1) nw = in - 1;
			else nw = in + 1;
			ans += nw + in;
			in = nw;
		}else ans += (2 * in);
	//	cout<<ans el;
		c1--, c2--;
		if(c1 == 0 && s1 == 1){
			c1 = ar[2]; s1 = -1;
		}
		if(c2 == 0 && s2 == 1){
			c2 = ar[4]; s2 = -1;
		}
	}
	cout<<ans el;
	return 0;
}

#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int a[6];
    for (int i = 0 ; i < 6 ; i++)
        scanf("%d",&a[i]);
    int t = pow(a[0]+a[1]+a[2],2);
    t -= (a[0]*a[0] + a[2]*a[2] + a[4]*a[4]);
    cout << t << endl;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	ll a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	ll x = a + b + c;
	cout << x*x - a*a - c*c - e*e << endl;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c, d, e, f;
	double s, w, q, r, p;

	scanf( "%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	s = ( a * b + c * d + e * f) * sqrt( 3) * 1.0 / 4;
	q = sqrt( a * a + b * b + a * b);
	w = sqrt( c * c + d * d + c * d);
	r = sqrt( e * e + f * f + e * f);
	p = ( q + w + r) / 2;
	s += sqrt( p * ( p - w) * ( p - q) * ( p - r));
	a = s / sqrt( 3) * 4 + 0.5;
	printf( "%d\n", a);
	return 0;
}

#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <algorithm>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <iostream>

using namespace std;

#define max(a,b) ( a < b ? b : a )
#define min(a,b) ( a > b ? b : a )
#define alter(move) ( ( move + 1 ) % 2 )
#define inf -12345678
#define MAX_SIZE 20000000
#define MOD 1000000007
#define T long

int main()
{
	T a1, a2, a3, a4, a5, a6;
	T i, sum, t;
	while( cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6  ) {
		t = a1*2 + 1;
		sum = 0;
		for( i=0; i<min(a2,a6); i++) {
			sum += t;
			t += 2;
		}
		t -= 2;
		if( abs(a2 - a6) > 0 ) {
			t++;
			sum += abs(a2 - a6) * t;
			t--;
		}
		for( i=0; i<min(a3,a5); i++ ) {
			sum += t;
			t -= 2;
		}
		cout << sum << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
#include <ext/hash_map>

using namespace std;
using namespace __gnu_cxx;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define oo (1<<30)
#define sz(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define mem(s,v) memset(s,v,sizeof(s))
#define ppc(x) __builtin_popcount((x))
#define iter(it,s) for(__typeof(s.begin())it = s.begin();it!=s.end();it++)
#define sci(i) scanf("%d",&(i))
#define scd(d) scanf("%lf",&(d))
#define scs(s) scanf("%s",(s))

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef vector<pi> vpi;

int dx[] = { 0, 0, 1, -1 };
int dy[] = { 1, -1, 0, 0 };

int main() {
#ifndef ONLINE_JUDGE
	freopen("test.in", "rt", stdin);
//	freopen("o.txt", "wt", stdout);
#endif
	int top, l1, l2, r1, r2, bot;
	cin >> top >> r1 >> r2 >> bot >> l2 >> l1;
	int res = 0, cur = top * 2 + 1, cnt = 0, a = l1, b = r1, add1 = 1, add2 = 1;
	while (cnt < 3) {
    res += cur;
    cur += add1 + add2;
	  a --, b --;
	  if (!a)
	    a = l2, add1 = -1, cur --, cnt ++;
	  if (!b)
	    b = r2, add2 = -1, cur --, cnt ++;
	}
	cout << res << endl;
	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main() {
	double a[6];
	double down = 0.5*sqrt(1-(0.5*0.5));

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

	double area = (sqrt(3.0)/4.0)*(((a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]));
	long long ans = round(area/down) ;
	cout <<ans ;

	return 0;
}

#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = ~0u >> 2;
const double eps = 1e-8;
const double pi = 3.1415926535897932384626;
const int mod = 0;

struct Point{
	double x, y;
	Point() {}
	Point(double x, double y) : x(x), y(y) {}
	Point operator +(const Point &p)const {return Point(x + p.x, y + p.y);}
	Point operator -(const Point &p)const {return Point(x - p.x, y - p.y);}
}p[10], v[10];

int a[10];

double det(Point a, Point b) {return a.x * b.y - b.x * a.y;}
double dot(Point a, Point b) {return a.x * b.x + a.y * b.y;}

int main() {
	for (int i = 0; i < 6; i++) scanf("%d", a + i);
	for (int i = 0; i < 6; i++) {
		v[i] = Point(a[i] * cos(i * pi / 3), a[i] * sin(i * pi / 3));
	}
	p[0] = Point(0, 0);
	p[1] = p[0] + v[0];
	p[2] = p[1] + v[1];
	p[3] = p[2] + v[2];
	p[4] = p[3] + v[3];
	p[5] = p[4] + v[4];
	double area = 0;
	for (int i = 1; i < 5; i++)
			area += det(p[i], p[i + 1]);
	area = fabs(area) / 2.0;
	int A = (int)(area * 4.0 / sqrt(3) + eps);
	printf("%d\n", A);
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int a, b, c, d, e, f;
    while (cin >> a&&a)
    {
        cin >> b >> c >> d >> e >> f;
        int s = 0;
        s = (a + b + c)*(a + b + c) - a*a-c*c-e*e;
        cout << s << endl;
    }
}

#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long lld;

int main()
{
	int a[6];
	for (int i = 0; i < 6; i++)
		cin >> a[i];
	int space = 0.0;
	for (int i = 0; i < 6; i+=2)
		space += a[i] * a[i + 1];
	space *= 2;
	space += (a[0] - a[3])* (a[0] - a[3]);
	cout << space;
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#define rep(i,l,r) for(int i=l;i<=r;++i)
using namespace std;
typedef long long ll;
int x[7];
ll ans;
int main(){
	rep(i,1,6)scanf("%d",&x[i]);
	int k;
	rep(i,1,min(x[1],x[3])){
		ans += (x[2] + i - 1)*2+1;
		k = (x[2] +i -1)*2+1;
	}
	rep(i,1,min(x[6],x[4])){
		ans += (x[5] + i - 1)*2+1;
	}
	rep(i,min(x[1],x[3])+1,max(x[1],x[3])){
		ans += k + 1;
	}
	cout<<ans << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;;

int apsum(int a, int n,int d){
	return (n*(2*a+((n-1)*d)))/2;
}

int ap(int a, int n, int d){
	return a+(n-1)*d;
}

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

	cin>>a>>b>>c>>d>>e>>f;

	int ans=(apsum(2*c+1,min(b,d),2))+(apsum(2*f+1,min(a,e),2))+(1+ap(2*c+1,min(b,d),2))*(abs(b-d));
	cout<<ans<<endl;
}

#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <complex>
#include<map>
#include<queue>
#include <iostream>
#include<unordered_map>
using namespace std;
typedef long long ll;
int a[6];
int main(){
	for (int i = 0; i < 6; ++i)
		cin >> a[i];
	cout << (a[0] + a[1] + a[2])*(a[0] + a[1] + a[2]) - a[0] * a[0] - a[2] * a[2] - a[4] * a[4];
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define LL long long
#define oo (1<<30)
using namespace std;
LL ans,a[10];
LL Sum(LL x,LL n)
{
    return n*x+n*(n-1);
}
LL X(LL x,LL n)
{
    return x+(n-1)*2;
}
int main()
{
    int i;
    for(i=1;i<=6;i++) cin>>a[i];
    ans+=Sum(2*a[2]+1,min(a[1],a[3]));
    ans+=Sum(2*a[5]+1,min(a[4],a[6]));
    a[7]=a[2]+min(a[1],a[3]);
    a[8]=max(a[1],a[3])-min(a[1],a[3]);
    ans+=2*a[7]*a[8];
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main(){
    lli n[6],m;
    for (int i = 0; i < 6; ++i)
    {
        cin>>n[i];
    }

    m = pow((n[0]+n[1]+n[2]),2) - (pow(n[0],2)+pow(n[2],2)+pow(n[4],2));

    cout<<m;

}

#include <bits/stdc++.h>

using namespace std;

int main () {

	int a1, a2, a3, a4, a5, a6;
	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
	cout << (a1 + a2 + a3) * (a1 + a2 + a3) - a1 * a1 - a3 * a3 - a5 * a5;

	return 0;
}

#include<bits/stdc++.h>
 using namespace std;
int main()
{
    int A[6];
    for(int i=1;i<=6;i++)
      cin>>A[i];
    int ans;
    ans=(pow((A[1]+A[3]+A[2]),2)-pow(A[1],2)-pow(A[3],2)-pow(A[5],2));
    cout<<ans;
}

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

using namespace std;

int main (){
	int a1, a2, a3, a4, a5, a6, i;

	scanf ("%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6);
	int sum = 0;
	for (i = 0; i < a2 && i < a6; ++i)
		sum += (2 * a1 + 1 + 2 * i);
	sum += (abs(a2 - a6)) * (2 * a1 + 2 + 2 * (i - 1));
	for (i = 0; i < a3 && i < a5; ++i)
		sum += (2 * a4 + 1 + 2 * i);
	printf ("%d\n", sum);

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int s, a[10], res;
int main()
{
    for(int i = 1; i <= 6; i++) cin >> a[i];

    res = 2 * (a[1] + a[2]) * (a[5] + a[6]);
    res = res - a[5] * a[5] - a[2] * a[2];
    cout << res;
    return 0;
}

#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	cout<<(a+b+c)*(a+b+c)-a*a-c*c-e*e<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

template <typename T>
using lim = numeric_limits<T>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);

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

	int ans = 0;
	int curr = a[5];
	int i = 1;
	for (i = 1; i <= min(a[0], a[4]); i++){
		curr++;
		ans += curr;
	}

	for (; i <= max(a[0],a[4]); i++){
		ans += curr;
	}

	for ( ; i < a[0]+a[1]; i++){
		curr--;
		ans += curr;
	}
	ans *= 2;
	ans += a[2]+a[5];
	cout << ans << "\n";
}

#include <bits/stdc++.h>
using namespace std;

#define maxn -2000000 //negative value to break code and force you to put right constraint
#define mod 998244353
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 1000000000
#define INFd 1e9
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;

int main()
{
	int a[6];
	for(int i=0;i<6;i++)
		cin>>a[i];
	int ans=pow(a[0]+a[1]+a[2],2)-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];
	cout<<ans;
}

#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;

double num[10];
int main()
{
	for(int i = 0; i < 6; i++)
		cin >> num[i];
	double total = (num[0] + num[1] / 2 + num[5] / 2) * (num[1] / 2 + num[2] / 2);
	total -= (num[5] * num[5] + num[1] * num[1] + num[2] * num[2] + num[4] * num[4]) / 8;
	cout << (int)(total * 4) << endl;

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<map>
using namespace std;
__int64 ans(int a){
	__int64 an=1,x=1;
	for (int i = 1; i < a; i++){
		x += 2; an += x;
	}
	return an;
}
int main(){
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int a1, a2, a3, a4, a5, a6;
	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
	__int64 b1, b2, b3, b4;
	b1 = ans(a1 + a6 + a2); b2 = ans(a6); b3 = ans(a2); b4= ans(a4);
	__int64 b5 = b1 - b2 - b3 - b4;
	cout << b5;
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int get6(vector<int>& v)
{
    int sum = 0;
    for(int i =0; i < 6; ++i)
    {
        sum += v[i] * 2 - 1;
        --v[i];
    }
    return sum;
}

int get4(vector<int> v)
{
    sort(v.begin(), v.end());

    if(v[0] == v[1] && v[2] == v[3]) //  assert(v[0] == v[1])
        return 2 * v[2] * v[0];
    else //assert(v[1] == v[2])
    {
        int sum = 0;
        int k = v[3];
        for(int i = 0; i < v[1]; ++i)
        {
            sum += 2 * k - 1;
            --k;
        }
        return sum;
    }
}

int get3(int val)
{
    return val * val;
}

int find_min(const vector<int>& v)
{
    int r = v[0];
    for(int i = 1; i<v.size(); ++i)
        r = min(r,v[i]);
    return r;
}

int main()
{
    vector<int> v(6);
    for(int i = 0; i < 6; ++i)
        cin >> v[i];

    int sum = 0;
    while(find_min(v) > 0)
        sum += get6(v);

//    cout << "v = " << endl;
//    for(int i = 0; i < 6; ++i)
//        cout << v[i] << " ";
//    cout <<endl;
    vector<int> b;
    for(int i = 0; i < 6; ++i)
        if(v[i] > 0)
            b.push_back(v[i]);

    v = b;
//    cout <<"v.size() = " << v.size() << endl;
    if(v.size() == 5)
    {

            int idx;
            for(idx = 0; idx < 5; ++idx)
                if(v[idx] + v[(idx+1)%5] == v[(idx+3)%5]
                   && v[idx] + v[(idx-1+5)%5] == v[(idx-3+5)%5])
                   break;
            sum += v[(idx+3)%5] * v[(idx-3+5)%5] *2 - v[idx] * v[idx];
//            for(int i = 0; i < 5; ++i)
//                cout << v[i] << " ";
//            cout << endl;
//            cout << "idx = " << idx << endl;
//            cout << "5: " << v[(idx+2)%5] * v[(idx-2+5)%5] *2 - v[idx] * v[idx]  << "vidx = " << v[idx] <<endl;

    }
    else if(v.size() == 4)
        sum += get4(v);
    else if(v.size() == 3)
        sum += get3(v[0]);

    cout << sum << endl;

    return 0;
}

#include <stdio.h>
#include <math.h>
int num[6];
double pos[6][2];
struct Vec
{
	double dx;
	double dy;
	Vec()
	{
		dx=0;
		dy=0;
	}
	Vec(double p1[2],double p2[2])
	{
		dx=p2[0]-p1[0];
		dy=p2[1]-p1[1];
	}
};
int input()
{
	for(int i=0;i<6;i++)
		if(scanf("%d",num+i)==EOF)return 0;
	return 1;
}
double Abs(double x)
{
	if(x<0)return -x;
	else return x;
}
double mod(Vec v)
{
	return sqrt(v.dx*v.dx+v.dy*v.dy);
}
double sin(Vec v1,Vec v2)
{
	double dx=v1.dx*v2.dy,dy=v1.dy*v2.dx;
	double sum1=Abs(dx-dy);
	double sum2=mod(v1)*mod(v2);
	return sum1/sum2;
}
int make()
{
	double sq3=sqrt(3.0);
	pos[0][0]=0;
	pos[0][1]=0;
	pos[1][0]=pos[0][0]-0.5*num[0];
	pos[1][1]=0.5*sq3*num[0]+pos[0][1];
	pos[2][0]=0.5*num[1]+pos[1][0];
	pos[2][1]=0.5*sq3*num[1]+pos[1][1];
	pos[3][0]=pos[2][0]+num[2];
	pos[3][1]=pos[2][1];
	pos[4][0]=0.5*num[3]+pos[3][0];
	pos[4][1]=pos[3][1]-0.5*sq3*num[3];
	pos[5][0]=pos[4][0]-0.5*num[4];
	pos[5][1]=pos[4][1]-0.5*sq3*num[4];
	return 1;
}
int calc()
{
	Vec v1=Vec(pos[0],pos[1]);
	Vec v2=Vec(pos[0],pos[2]);
	Vec v3=Vec(pos[0],pos[3]);
	Vec v4=Vec(pos[0],pos[4]);
	Vec v5=Vec(pos[0],pos[5]);
	double sum1=0.5*mod(v1)*mod(v2)*sin(v1,v2);
	double sum2=0.5*mod(v2)*mod(v3)*sin(v2,v3);
	double sum3=0.5*mod(v3)*mod(v4)*sin(v3,v4);
	double sum4=0.5*mod(v4)*mod(v5)*sin(v4,v5);
	double sumt=0.5*sqrt(3.0)*0.5;
	return (int)((sum1+sum2+sum3+sum4)/sumt+0.5);
}
int run()
{
	if(!input())return 0;
	make();
	int ans=calc();
	printf("%d\n",ans);
	return 1;
}
int main()
{
	while(run());
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{ ll a,a1,a2,a3,a4,a5,a6,area;
      double area1;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;
     area=pow((a1+a2+a3),2)-pow(a1,2)-pow(a3,2)-pow(a5,2);
       area1=ceil(1.732/4);
       a=area/area1;
       cout<<area;
   }

#include<bits/stdc++.h>
#define FIO ios::sync_with_stdio(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<vector<int> > vvi;
typedef pair<int,int> ii;

string num_to_str(int n)
{
    string res="";
    if(!n)
        return "0";
    while(n)
    {
        res+=((n%10)+'0');
        n/=10;
    }
    reverse(res.begin(),res.end());
    return res;
}
int str_to_num(string s)
{
    int res=0,p=1;
    for(int i=s.size()-1; i>=0; i--)
        res+=((s[i]-'0')*p), p*=10;
    return res;
}
int get_f(ll n)
{
    int f=0;
    while(n)
    {
        f=n%10;
        n/=10;
    }
    return f;
}

struct point
{
    double x,y;
    point()
    {
        x=0;
        y=0;
    }
};

point f(point tt,long double r,long double theta)
{
    point t;
    t.x=r*cos(theta)+tt.x;
    t.y=r*sin(theta)+tt.y;
    return t;
}
double ComputeSignedArea(const vector<point> &p) {
    double area = 0;
    for (int i = 0; i < p.size(); i++) {
        int j = (i + 1) % p.size();
        area += p[i].x * p[j].y - p[j].x * p[i].y;
    }
    return area / 2.0;
}

double ComputeArea(const vector<point> &p) {
    return fabs(ComputeSignedArea(p));
}
const double  PI=acos(-1);
int main()
{
    FIO;
    int n=6;
    double a[n];
    for(int i=0;i<6;i++)
        cin>>a[i];
    vector<point>v(6);
    long double angle=0.0;
    for(int i=1;i<6;i++)
    {
        v[i]=f(v[i-1],a[i-1],angle);
        angle-=(PI/3.0);
    }
  long double tr=(sqrt(3))/4.0,area=ComputeArea(v);
  cout<<(ll)round(area/tr)<<endl;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
    int a1,a2,a3,a4,a5,a6;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;
    int ans=(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5;
    printf("%d\n",ans);
    return 0;
}

#include<bits/stdc++.h> // 76 87 "Baklol"
using namespace std;

#define rep(x, k, n)    for(int x = (k); x < (n); ++x)
#define repr(x, k, n)   for(int x = (k); x > (n); --x)
#define tr(it,a)        for(auto it = (a).begin(); it != (a).end(); ++it)
#define ll              long long
#define siz(x)          ((int)(x).size())
#define print(x)        cout << (x) << '\n'
#define prints(x)       cout << (x) << " "
#define eb              emplace_back
#define mp              make_pair
#define F               first
#define S               second
#define o2(x)           ( (x) * (x) )
#define all(x)          (x).begin(), (x).end()
#define allr(x)         (x).rbegin(), (x).rend()
#define clr(x,k)        memset(x, k, sizeof(x))
#define sortall(x)      sort(all(x))
#define sortalld(x)     sort(all(x), greater<int>())
#define printv(v)       rep(x, 0, siz(v)){ prints(v[x]); } cout << '\n'
#define print2dv(V)     rep(y, 0, siz(V)){ printv(V[y]); }
#define out(x)          cout << ((x) ? "Yes" : "No") << '\n';
#define PI              3.1415926535897932384626
#define inf             INT_MAX
#define ninf            INT_MIN
#define int             long long // take care of it when too much computation required

typedef pair<int,int>   pii;
typedef pair<ll,ll>     pll;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<char>    vc;
typedef vector<bool>    vb;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vb>      vvb;
typedef vector<vpii>    vvpii;

template <typename Arg1>
void debug_out(const char* name, Arg1&& arg1){
    cout << name << " = " << arg1  << " ]" << '\n';
}
template <typename Arg1, typename... Args>
void debug_out(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " = " << arg1 <<",";
    debug_out(comma+1, args...);
}

#ifndef ONLINE_JUDGE
#define deb(...) cout << "[ ", debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define deb(...)
#endif

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const int mod = 1e9+7;
const int N = 3e5, M = N;

/*
->Do not forget to check the edge cases.
->Make sure you are submitting the right file.
->Do not make "easy->complicated", xd... :|.
*/

//-----------------------------------------------------------------------------

void Solve_main() {
    int n, m, k;

    vector<long double> a(6);
    rep(i, 0, 6){
        cin >> a[i];
    }
    long double area = o2((a[0] + a[1] + a[2])) - o2(a[0]) - o2(a[2]) - o2(a[4]);
    cout << (int)area << '\n';

}

//-----------------------------------------------------------------------------

int32_t main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    cout << setprecision(12) << fixed;
    int tc = 1;
    // cin >> tc;
    for(int i = 0; i < tc; i++) {
        Solve_main();
    }

    cerr << "[time:" << 1.0*clock()/CLOCKS_PER_SEC << "s] ";
    return 0;
}

#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
using namespace std ;
typedef long long ll ;
typedef long long int lli ;
typedef vector<int> vi ;
typedef pair<int, int> ii ;
typedef pair<int, string > is ;
typedef pair<string, string > ss ;
typedef vector<ii> vii ;
typedef set<int> si ;
typedef map<string, int> msi ;
#define FF ios_base::sync_with_stdio(false)
#define rep(i, a, o) \
for (int i = int(a); i <= int(o); i++)
#define Drep(i, a, o) \
for (int i = int(a); i >= int(o); i--)
#define INF 2000000000
#define MEMSET_INF 127
#define MEMSET_HALF_INF 63
#define MP make_pair
#define fi first
#define MOD 1000000007
#define se second
#define pb push_back
#define FC cin.tie(0);cout.tie(0);
int main()
{
    FF;
    FC;
    lli a[7] , j = 0 , jj = 0 ;
    rep(i,1,6){
        cin >>  a[i] ;
    }
    cout << setprecision(0) << fixed << powl(a[1] + a[2] + a[3] , 2 ) - powl(a[1],2) - powl(a[3],2) - powl(a[5],2) ;
}

// Area of any polygon - 1/2*abs((x1y2-x2y1) + (x2y3-x3y2) + .... + (xny1-x1yn))
#include <bits/stdc++.h>
#define pp pair<long double, long double>
#define mp make_pair
#define ll long long
#define pb push_back
#define MAX (10 << 8)

using namespace std;

int main() {
	vector<long double> a(6,0);
	vector<pp> coord(6);
	for(int i=0; i<6; i++) {
		cin >> a[i];
	}
	long double sqrt3 = sqrt(3);
	coord[0] = mp(0,0);
	coord[1] = mp(a[0],0);
	coord[2] = mp(a[0]+(a[1]/2), a[1]*sqrt3/2);
	coord[3] = mp(a[0]+((a[1]-a[2])/2), (a[1]+a[2])*sqrt3/2);
	coord[4] = coord[3];
	coord[4].first -= a[3];
	coord[5] = mp(-(a[5]/2), a[5]*sqrt3/2);
	long double ans=0.0;
	for(int i=0; i<6; i++) {
		int j=i+1;
		j%=6;
		ans+=(coord[i].first*coord[j].second - coord[i].second*coord[j].first);
	}
	cout << std::fixed;
	cout.precision(0);
	cout << abs(ans/2)*4/sqrt3 << endl;
	// cout << (a[0] + a[1] + a[2])*(a[0] + a[1] + a[2]) - a[0]*a[0] - a[2]*a[2] - a[4]*a[4];
}

#include<bits/stdc++.h>
#define MOD 1000000007
#define MAX 100005
#define P 1 << 15
#define ll long long
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define slld(t) scanf("%lld",&t)
#define plld(t) printf("%lld\n",t)
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define eph 0.0000000001
#define slf(x) scanf("%0.12lf",&x)
#define plf(x) printf("%0.12lf\n",x)
using namespace std;

struct cmp
{
    bool operator()(pii a ,pii b){
        return a.second > b.second;
    }
};

ll modpow(ll base, ll exp, ll mod)
{
  base %= mod;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("C:/Users/HP/Desktop/codejam/1A_large_input.txt","r",stdin);//redirects standard input
	//freopen("C:/Users/HP/Desktop/codejam/1A_large_output.txt","w",stdout);//redirects standard output
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	cout<<(a+b+c)*(a+b+c)-a*a-c*c-e*e<<endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long x,sum=0,y=1;
    bool plus1=0;
    int a[6];
    for(int i=0; i<6; i++)
        cin>>a[i];
    x=a[1]+a[2]+a[3];
    while(x--)
        sum+=y,y+=2;
    x=a[1],y=1;
    while(x--)
        sum-=y,y+=2;
    x=a[3],y=1;
    while(x--)
        sum-=y,y+=2;
    x=a[5],y=1;
    while(x--)
        sum-=y,y+=2;
    cout<<sum;
    return 0;
}

/*

    This Code and Template is my personal property,
    It's handcrafted by me (Siddharth Singh)

    You are not allowed to lift Macros/Functions or any thing
    without my permission.

    If you want to take any thing, let me know first.
    If i approve then only you can use it.

    I will mention everyone who copies without my permission

    List of uncreative/non-talented people copying macros/template

    ~ Updated 2nd June 2020

    1.
    2.
*/

#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

//methods: find_by_order(k); & order_of_key(k);
//To make it an ordered_multiset, use pairs of (value, time_of_insertion)
//to distinguish values which are similar

// Type Redefinitions
#define int long long
#define double long double
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define ADJ map<int,set<int>>
#define vpii vector<pii>
#define fmap gp_hash_table
#define LONG LLONG

// Shorthand Macros
#define pb push_back
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define all(x) x.begin(),x.end()
#define endl "\n"
#define NL cout<<'\n';
#define F first
#define S second
#define disp(x) for(auto t : x )cout<<t<<" ";
#define for0(n) for(int i=0;i<n;i++)
#define for0j(n) for(int j=0;j<n;j++)
#define oldfor(v) for(auto it = v.begin(); it != v.end(); ++it)
#define SS <<" "<<
#define acum accumulate
#define arrin(a,n) vi a(n);for0(n){cin>>a[i];}
#define pf(x) cout<<x<<endl;
#define Check pf("Check")
#define gridin(num,n,m) for0(n){for0j(m) cin>>num[i][j];}
#define dispgrid(num,n,m) for0(n){for0j(m) cout<<num[i][j]<<" "; cout<<endl;}

// IO Helpers
#define tks(x) string x;cin >> x;
#define tk(a) int a;cin>>a;
#define tk2(a,b)tk(a)tk(b)
#define tk3(a,b,c)tk2(a,b)tk(c)
#define tk4(a,b,c,d)tk2(a,b)tk2(c,d)
#define tk5(a,b,c,d,e)tk4(a,b,c,d)tk(e)
#define tk6(a,b,c,d,e,f)tk3(a,b,c)tk3(d,e,f)
#define tk7(a,b,c,d,e,f,g)tk6(a,b,c,d,e,f)tk(g)
#define tk8(a,b,c,d,e,f,g,h)tk7(a,b,c,d,e,f,g)tk(h)
#define addEdge(adj,u,v) tk2(u,v) adj[u].insert(v);adj[v].insert(u);
#define test tk(test)while(test--)

// Common Affirmations
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;

// Common Constants
const int MOD=1000000007;
const int N=100000;

// Overloaded Ostream Classes
template < typename T >
ostream &operator<<(ostream &os,const vector<T> &v){os<< "{";oldfor(v){if(it!=v.bg)os<<", ";os<<*it;}return os << "}";}

template<typename F, typename S>
ostream& operator<<(ostream& os,const pair<F,S> &p){return os << "(" << p.F << ", " << p.S << ")";}

template < typename T >
ostream &operator << (ostream &os, const set<T> &v){os << "[";oldfor(v){if(it!=v.bg)os<< ", ";os << *it;}return os << "]";}

template < typename T >
ostream &operator << (ostream &os, const multiset<T> &v){os << "[";oldfor(v){if(it!=v.bg) os << ", ";os<<*it;}return os << "]";}

template < typename F, typename S >
ostream &operator <<(ostream & os, const map<F,S> &v){os << "[";oldfor(v){if(it!=v.bg)os<< ", ";os<< it->F<<" = "<<it->S;}return os << "]";}

/*
    Common Theory :

    1. To find number of elements less than k in array a
       answer would be int res = upper_bound(all(a),k) - a.bg

    2. To find number of elements greater than k in array a
       answer would be int res = a.ed - upper_bound(all(a),k)

    3. Min Heap = priority_queue<int,vector<int>, greater<int>> que;
       Max Heap = priority_queue<int> que;

    4. Is Function Monotonus, Can you solve for a given res?
       Think about Binary Searching !

    5. Can't be sure if greedy is optimal? Constraints are low?
       Think about Dynamic Programming !

    6. Don't forget a grid is a graph.

    7. Watch out for function overhead

*/

int solve(int a,int b){
	int res=0;
//	pf("SIDE : " SS a SS " BASE : " SS b)
	for0(a){
		res+=(2*b+1);
		b++;
	}
	return res;
}

void rotate(vi &a){
	vi res;
	for(int i=1;i<a.sz;i++){
		res.pb(a[i]);
	}
	res.pb(a[0]);
	a=res;
}
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	arrin(a,6)
	int res1=0;
//	pf(a)
	while(a[0]>0 && a[2]>0){
		res1+=(2*a[1]+1);
		a[0]--;
		a[2]--;
		a[1]++;
	}

	int res2=0;

	while(a[3]>0 && a[5]>0){
		res2+=(2*a[4]+1);
		a[3]--;
		a[5]--;
		a[4]++;
	}

	set<int> s(all(a));
	if(s.find(0)!=s.ed){
		s.erase(s.find(0));
	}
	//pf(s)
	vi bb(all(s));

	int res3=0;
	for0(bb[0] && bb.sz>=2){
		res3+=(2*bb[1]);
	}
	int fin=res1+res2+res3;
	pf(fin)
//	pf(res1 SS res2 SS res3)
	return 0;
}

#include <bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;

int read()
{
	int num=0;
	int flg=1;
	char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
		{
			flg=-1;
		}
		c=getchar();
	}
	while(isdigit(c))
	{
		num=(num<<1)+(num<<3)+(c^48);
		c=getchar();
	}
	return num*flg;
}

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

#include <bits/stdc++.h>
#define PI = 3.141592654;
using namespace std;
int i , j , k , l;
typedef long long  ll ;
template <class T>
void print(T x[],int size){for(int i=0;i<size;++i)cout<<x[i]<<" ";cout<<endl;}
int main(){
    int a[6];
    ll z = 0;
    for (i = 0 ; i < 6 ; ++i)
        cin >> a[i];
    z = (a[0] + a[2] + a[1]) * (a[1] + a[2] + a[0]);
    z -= (a[0] * a[0]);
    z -= (a[2] * a[2]);
    z -= (a[4] * a[4]);
    cout << z << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a1, a2, a3, a4, a5, a6, ans;
int main()
{
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    ans = a1 + a6 + a5;
    ans = ans*ans - a1*a1 - a3*a3 - a5*a5;
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define oo 1e9
#define pi 3.1415926536
#define OO 1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
ll a,b,c,x,y,z;
int main(){
    Hossam_Yehia;
    cin >> a >> b >> c >> x >> y >> z;
    cout<<(ll)(pow(a+b+c,2)-pow(a,2)-pow(c,2)-pow(y,2))<<endl;
    re 0;
}

#include <bits/stdc++.h>
#define forn(i, a, b) for (long i=a; i<=b; i++)
#define ms(a,x) memset(a, x, sizeof(a))
#define MIN(a,b) ((a>b)? (b): (a))
#define MAX(a,b) ((a<b)? (b): (a))

using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    //freopen("in.txt","r",stdin);
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    int x,y,z,s;
    if (b > f) swap(b, f);
    if (e > c) swap(e, c);

    x = ( 2*a + b )*b;
    y = ( a + b )*( f- b)*2;
    z = ( 2*d + e )*e;
//S printf("%d  %d  %d\n",x,y,z);
    s = x+ y+ z;
        printf("%d",s);
}

#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target("popcnt") //https://godbolt.org/z/yQv94Y

#define INF 1e9
#define pi 3.141592653589
//#define e 2.718281828459
#define phi 1.618033988749
#define MOD 1000000007

#define print2d(mat,n,m){for(int i=0;i<(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<<endl;}}
#define printarr(arr,n){for(int i=0;i<(n);i++){cout<<arr[i]<<" ";}cout<<endl;}

typedef long long int ll;
typedef unsigned long long int  ull;
typedef long double ld;

#define foreach(it , l) for(auto it = l.begin(); it != l.end(); ++it)
#define xlr8 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define matl vector<vector<ll> >
#define mati vector<vector<int> >

#define rev_sort(a) sort(a.rbegin(),a.rend());

template<typename T>
class Sieve
{
    public:
        vector<T> primes;
        vector<bool> is_prime;
        Sieve(int MAX = 1000000)
        {
            is_prime.resize(MAX + 1, true);
            is_prime[0] = is_prime[1] = false;
            for(ll i = 2; i*i <=MAX; i++)
                if(is_prime[i])
                    for(ll j = i*i ; j<=MAX; j+=i)
                        is_prime[j] = false;

            for(ll i =2; i<=MAX; i++)
                if(is_prime[i])
                    primes.push_back(i);
        }
};
template<typename T>
vector<vector<T> > matmul(const vector<vector<T>>& a,const vector<vector<T> >& b )
{
    int n = a.size() , m = b[0].size(), k = b.size();
    vector<vector<T> > c(n,vector<T> (m));
    for(int i = 0; i<n; i++)
    {
        for(int j = 0; j<m; j++)
        {
            for(int l = 0; l<k; l++)
                c[i][j]+= (a[i][k]* b[k][j]);
        }
    }
    return c;

}
template<typename T>
T extended_euclid(T a, T b, vector<T>& X)
{
    if(b==0)
    {
        X = {1,0};
        return a;
    }
    else
    {
        T g = extended_euclid(b, a%b, X);
        vector<vector<T> > G = {{0LL , 1LL}, {1LL, -(a/b)}};
        X = matmul<T>(G,X);
        return g;
    }
}
template<typename T>
bool isPrime(T n)
{
    if(n<=1)
        return false;
    else if (n ==2 || n == 3)
        return true;
    else if(n%2==0 || n%3 == 0)
        return false;

    T x = 5;
    T p = 2;
    while(x*x<=n)
    {
        if(n%x==0)
            return true;
        x+=p;
        p = 6 - p;
    }
    return true;

}
ll binpow(ll x, ll n,ll mod = MOD )
{
    ll ans =1;
    x = x%mod;
    while(n>=1)
    {
        if(n&1)
            ans=(ans*x)%mod;
        x=(x*x)%mod;
        n>>=1;

    }
    return ans;
}
ll gcd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcd (b,a%b);
}
template<typename T>
class Graph
{
    public:
        int n;
        vector<vector<T> > adj;
        bool directed;
        Graph(int n, bool directed = false)
        {
            this->n = n;
            adj.resize(n+1);
            this->directed = directed;
        }
        void add_edge(int u ,int v)
        {
            adj[u].push_back(v);
            if(!directed)
                adj[v].push_back(u);
        }
        void add_edge(int u, int v, int w)
        {
            adj[u].push_back({v,w});
            if(!directed)
                adj[v].push_back({u,w});
        }

};
/*
    knight
    int dir_r[]  = {-2 ,-1 , 1, 2 ,-2 ,-1, 2 , 1 };
    int dir_c[]  = {1 , 2 , 2 , 1 ,-1 ,-2,-1 , -2};
    king
    int dir_r[] = {-1, -1, 0 , 1, 1, 1, 0, -1};
    int dir_c[] = {0, 1, 1, 1, 0, -1, -1, -1};
    side
    int dir_r[] = {1, 0, -1, 0};
    int dir_c[] = {0, 1, 0, -1};
    diagonal
    int dir_r[] = {1, 1 , -1, -1};
    int dir_c[] = {1, -1, 1,  -1};
*/

class DisjointSets
{
    public:
        int n;
        vector<int> parent;
        vector<int> rank;
        vector<int> sz;

        DisjointSets(int n, bool Rank= true)
        {
            this->n = n;
            parent.resize(n+1,0);
            (Rank ? rank.resize(n+1,1) : sz.resize(n+1, 1));
        }

        int find(int i)
        {
            if(i!=parent[i])
                parent[i] = find(parent[i]);
            return parent[i];
        }
        void UnionByRank(int i , int j)
        {
            i = find(i);j = find(j);
            if(i==j)    return;
            if(rank[i]<rank[j])
                swap(i,j);
            parent[j] = i;
            rank[i]+=rank[j];
        }
        void UnionBySize(int i ,int j)
        {
            i = find(i);j = find(j);
            if(i==j)    return;
            if(sz[i] < sz[j])
                swap(i,j);
            parent[j] = i;
            sz[i]+=sz[j];
        }
};

template<typename T>
class SegmentTree
{
    public:
        vector<T> t;
        int n, H;
        void init(int n)
        {
            this->n = n;
            t.resize(2*n);
            this->H = sizeof(int)*8 - __builtin_clz(n);
        }
        void build()
        {
            for(int i = n-1; i>0;i--)
                t[i] = t[i<<1] + t[(i<<1)|1];
        }
        void update(int pos, T val)
        {
            for(t[pos+=n]+= val ; pos>1;pos>>=1)
                t[pos>>1] = t[pos] + t[pos^1];
        }
        T  query(int l, int r)
        {
            T res =0;
            for(l+=n,r+=n;l<r;l>>=1,r>>=1)
            {
                if(l&1)     res+=t[l++];
                if(r&1)     res+=t[--r];
            }
            return res;
        }
};
bool isSubsequenceString(string x, string y)
{
    int i = 0 ,j = 0;
    while(i<x.length() && j<y.length())
        x[i]==y[j] ? i++,j++ : i++;
    return (j==y.length());
}

int trailing9s(ll n)
{
    int cnt = 0;
    while(n > 0 && n%10 == 9)
    {
        cnt++;
        n/=10;
    }
    return cnt;
}
int main()
{
    xlr8;
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    int ans = 0;
    int m  = min(b,f);
    ans = m*(2*a + m);
    int n = min(c,e);
    ans+= n*(2*d + n);
    int x = (b+c - m - n);
    int y = 2*(a+m);
    ans+=(x*y);
    cout<<ans<<"\n";
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<iostream>
#include<stack>
#include<vector>
#include<set>
#include<string>
using namespace std;
typedef unsigned long long LL;
const int maxn = 250000;
const int MAXN = 2200;
const int mod=1000000007;
int a[10];
int main() {
    for(int i=1;i<=6;i++)
        cin>>a[i];
    int sum=0;
    sum=a[1]+a[2]+a[3];
    sum=sum*sum;
    sum-=(a[1]*a[1]+a[3]*a[3]+a[5]*a[5]);
    cout<<sum<<endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<string> vs;
typedef vector<pi> vpi;

#define fi          first
#define se          second
#define forall(i,a,b)               for(int i=a;i<b;++i)
#define forlla(i,a,b) for(int (i) = (a); (i) > (b); --(i))
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define sqr(a)  (((a) * (a)))
#define max(a,b)                    ( (a) > (b) ? (a) : (b))
#define min(a,b)                    ( (a) < (b) ? (a) : (b))
#define endl                        "\n"
const int oo = 1000000009;
const double eps = 1e-9;
const int mod = 1000000007;

int a[6];

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int ans=0,mi,ma;
    forall(i,0,6) cin >> a[i];
    ans = sqr(a[0]+a[1]+a[2])-(sqr(a[0])+sqr(a[2])+sqr(a[4]));
    cout << ans << endl;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <iterator>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <cstdio>

using namespace std;
typedef long long i64;
typedef vector<i64> vi64;
#define forn(i, n) for(i64 i = 0; i < n; i++)
#define turn(i, n) for(i64 i = n - 1; i >= 0; i--)

//vector< i64 > tree;
//vector<i64> ans;
//i64 n, k;
//i64 SIZE = 1<<17;
//i64 sum;
//
//
//ifstream in("sum2.in", ios::in);
//ofstream out("sum2.out", ios::out);
////
////void build()
////{
////  tree.resize(SIZE * 2, 0);
////  for (i64 i = 0; i < n; i++)
////      in >> tree[SIZE + i];
////
////  for (i64 i = SIZE - 1; i >= 1; i--)
////      tree[i] = tree[i * 2] + tree[i * 2 + 1];
////}
//
//void ask()
//{
//  i64 l, r;
//  sum = 0;
//  in >> l >> r;
//  l += SIZE - 1;
//  r += SIZE - 1;
//  r++;
//  for (; l < r; l /= 2, r /= 2)
//  {
//      if (l % 2)
//      {
//          sum += tree[l];
//          l++;
//      }
//      if (r % 2)
//      {
//          sum += tree[r - 1];
//          r--;
//      }
//  }
//  out << sum << '\n';
//}
//
//void update()
//{
//  i64 idx, idx2;
//  cin >> idx >> idx2;
//  idx += SIZE - 1;
//  idx2 += SIZE;
//
//}
vector<i64>v;
i64 n;

int main()
{
    v.resize(6);
    forn(i, 6)
    {
        cin >> v[i];
    }
    i64 ans = 0; i64 vych = 0;
    for (int i = 0; i < 6; i += 2)
    {
        i64 local = 0;
        if (!(v[i] % 2))
        {
            local = (1 + (v[i] * 2 - 1)) * (v[i] / 2);
        }
        else if (v[i] % 2 && v[i] != 1)
        {
            local = (1 + (v[i] * 2 - 1)) * (v[i] / 2) + ((1 + (v[i] * 2 - 1)) / 2);
        }
        else
        {
            local = 1;
        }
        vych += local;
    }
    v[1] += v[0];
    v[1] += v[2];
    if (!(v[1] % 2))
    {
        ans = (1 + (v[1] * 2 - 1)) * (v[1] / 2);
    }
    else if (v[1] % 2 && v[1] != 1)
    {
        ans = (1 + (v[1] * 2 - 1)) * (v[1] / 2) + ((1 + (v[1] * 2 - 1)) / 2);
    }
    else
    {
        ans = 1;
    }
    cout << ans - vych;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    int x = (a + b + c) * (a + b + c);
    a*=a;
    c*=c;
    e*=e;
    cout << x - (a + c + e) << endl;
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	cout << (a + b + c) * (a + b + c) - a * a - c * c - e * e;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[10];
	long long int jam=0;
	for(int i=0;i<6;i++){
		cin>>a[i];
	}
	jam=a[0]+a[1]+a[2];
	jam*=jam;
	jam=jam-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];
	cout<<jam;
}

// By Kishan Radia

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;

int main(){
    ll a1,a2,a3,a4,a5,a6;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;
    ll ans=0;
    ans=a1+a2+a3;
    ans*=ans;
    ans-=a1*a1;
    ans-=a3*a3;
    ans-=a5*a5;
    cout<<ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(0);
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int bok = a+b+c;
	cout << bok*bok-a*a-c*c-e*e << '\n';

	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int a[60];
bool isok(int a[]){
    if (a[1] == a[5] && a[2] == a[4] && a[0] + a[1] == a[2] + a[3])return true;
    else return false;
}
int count(int l, int h){
    return 2 * l*h + h*h;
}
int main()
{
    for (int i = 0; i < 6; ++i){
        cin >> a[i];
        a[i + 6] = a[i];
    }
    /*
    int cnt;
    for (cnt = 0; cnt < 6; ++cnt)if (isok(a + cnt))
        break;
    //cout << "The cnt = " << cnt <<" Head is "<< a[cnt] << endl;
    cout << count(a[cnt], a[cnt + 1]) + count(a[cnt + 3], a[cnt + 2]) << endl;
    */
    int chang, duan,plus;
    plus = a[1] * a[1] + a[4] * a[4];
    chang = a[0] + a[1];
    duan = a[1] + a[2];
    if (duan>chang)swap(duan, chang);
    int ans = duan*duan * 2 + duan * 2 * (chang - duan) - plus;
    cout << ans << endl;
    return 0;

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll prime(ll a){
ll c=1;
ll d=a;
for(ll i=2;i<=sqrt(a);i++){
    while(d%i==0){
      //  cout<<i<<" ";
        d=d/i;
        c=i;
    }
}
return max(c,d);
}
int main(){
    ll a[6];
    for(int i=0;i<6;i++){
        cin>>a[i];
    }
    ll sum=0;
    sum+=a[0]*a[1]+a[0]*a[2]+a[1]*a[2];
    sum+=a[3]*a[4]+a[3]*a[5]+a[5]*a[4];
    cout<<sum;

}

#include <bits/stdc++.h>
#define pb push_back
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)
using namespace std;

typedef long long ll;
int main() {
     //in;
    ll a[10];
    for (int i = 1; i <= 6; i++) {
        cin >> a[i];
    }

    ll x = a[6] + a[5] + a[4];

    cout << x * x - a[2]*a[2] - a[6]*a[6] - a[4]*a[4];
}

// 487 - Boggle Blitz
#include<iostream>
#include<stdio.h>
#include<vector>
#include<map>
#include <stdlib.h>
#include<algorithm>
#include<set>
#include <fstream>

using namespace std;

int main()
{
    int a1, a2, a3, a4, a5, a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    cout << ((a6 + a5 + a1) * (a1 + a5 + a6)) - (a1 * a1) - (a3 * a3) - (a5 * a5);
    return 0;
}

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

int edge[6];

bool vis[6];

int input()
{
	for (int i = 0; i < 6; i++)
		if(scanf("%d", &edge[i]) == EOF) return 0;
	return 1;
}
void init()
{

}

int main(void)
{
	while (input())
	{
		memset(vis, false, sizeof vis);
		int ans;
		ans = ((edge[0] + edge[1] + edge[2]) * (edge[0] + edge[1] + edge[2]) - edge[0] * edge[0] - edge[2] * edge[2] - (edge[0] + edge[1] - edge[3]) * (edge[0] + edge[1] - edge[3]));

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

#include<bits/stdc++.h>
using namespace std;
int main(){
    int ar[6];
    for(int i=0;i<6;++i)
        scanf("%d",&ar[i]);
    long long ans=0;
    int x=ar[1];
    int j=ar[0]<ar[2]?0:2;
    int k=2-j,l;
    if(j==0)
        l=5;
    else
        l=3;
    while(ar[j]){
        ans=ans+x+x+1;
        ar[j]--;
        ar[k]--;
        ++x;
    }
    while(ar[k]){
        ans=ans+2*x;
        --ar[k];
        --ar[l];
    }
    while(ar[l]){
        ans=ans+x+x-1;
        --x;
        --ar[l];
    }
    printf("%lld\n",ans);
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <list>
#include <fstream>
#include <climits>
#define ull unsigned long long
#define ll long long
#define ld long double
#define pi 3.1415926536
#define re return
#define mm(o,k) memset(o,k,sizeof o)
#define endl "\n"
#define hossam_yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
ll gcd(ll a,ll b){
    while(b) b^=a^=b^=a%=b;
    return a;
}
ll bigmod(ll n,ll power,ll mod){
    if(!power)
        return 1;
    if(power%2==0){
        int ret=bigmod(n,power/2,mod);
        return ((ret%mod)*(ret%mod))%mod;
    }
    else
		return ((n%mod)*(bigmod(n,power-1,mod)%mod))%mod;
}
ll power(ll x,ll y){
    ll res= 1;
    while(y){
        if (y&1)
            res*= x;
        x*=x;
        y>>=1;
    }
    return res;
}
ll n,a1,a2,a3,a4,a5,a6;
int main() {
	hossam_yehia
	cin>>a1>>a2>>a3>>a4>>a5>>a6;
	cout<<((a1+a2+a3)*(a1+a2+a3))-(a1*a1)-(a3*a3)-(a5*a5)<<endl;
	cin >> n;
	re 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    cout << (a+b+c)*(a+b+c)-a*a-c*c-e*e << endl;
}

/**************************************************
    WhatTheFua
    Anan Schuett
    arnan_s@msn.com
**************************************************/

#define BK back()
#define BL for(int K = 1; K <= T; K++)
#define F first
#define INF 2147483647LL
#define LNF 8000000000000000000LL
#define P107 1000000007LL
#define P109 1000000009LL
#define PB push_back
#define PF push_front
#define I insert
#define E erase
#define S second
#define SZ size()
#define IT iterator
#define db double
#define ll long long int
#define mp make_pair

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int inp[10];

int main()
{
    int res = 0,i;

    for(i = 0; i < 6; i++)
    {
        scanf("%d",inp + i);
    }

    printf("%d",(inp[0] + inp[1] + inp[2]) * (inp[0] + inp[1] + inp[2]) - inp[0] * inp[0] - inp[2] * inp[2] - inp[4] * inp[4]);
}

#include <iostream>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <math.h>
#define PI 3.14159265

using namespace std;

int main(){
    int a[6];
    for (int i=1 ;i<=6 ; i++)
        cin>>a[i];
    double c=((a[6]*cos(PI/3)+a[1]+a[2]*sin(PI/6))*(a[2]*cos(PI/6)+a[3]*cos(PI/6)))-(((a[6]*cos(PI/3)*a[6]*sin(PI/3))/2+(a[2]*cos(PI/3)*a[2]*sin(PI/3))/2+(a[3]*cos(PI/3)*a[3]*sin(PI/3))/2+(a[5]*cos(PI/3)*a[5]*sin(PI/3))/2));
    c/=sqrt(3)/4;
    cout<<setprecision(0);
    cout<<fixed<<c;
    cin>>c;
}

#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

int a[10];

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

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

	int s=a[0]+a[1]+a[2];

	int ans=s*s-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];

	println(ans);

}

#include <iostream>
#include <cmath>
using namespace std;

int main() {
	double a[6];
	double down = 0.5*sqrt(1-(0.5*0.5));

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

	double area = (sqrt(3.0)/4.0)*(((a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]));
	long long ans = round(area/down) ;
	cout <<ans ;

	return 0;
}

#include <bits/stdc++.h>
#define sflld(n) scanf("%lld",&n)
#define sfulld(n) scanf("%llu",&n)
#define sfd(n) scanf("%d",&n)
#define sfld(n) scanf("%ld",&n)
#define sfs(n) scanf("%s",&n)
#define ll long long
#define ull unsigned long long int
#define pflld(n) printf("%lld\n",n)
#define pfd(n) printf("%d\n",n)
#define pfld(n) printf("%ld\n",n)
#define lt 2*idx
#define rt 2*idx+1

using namespace std;

int main()
{
    int a[6],ans=0,m,r,l,i;
    for(i=0;i<6;i++)
        sfd(a[i]);
    //sort(a,a+6);
    m=a[0];
    l=a[1];
    r=a[5];
    while(l>0&&r>0)
    {
        ans+=2*m+1;
        m++;
        l--;
        r--;
    }
    l=max(l,r);
    while(l>0)
    {
        ans+=2*m;
        l--;
    }
    m=a[3];
    l=a[2];
    r=a[4];
    while(l>0&&r>0)
    {
        ans+=2*m+1;
        m++;
        l--;
        r--;
    }

    pfd(ans);
    return 0;
}

#include <bits/stdc++.h>
typedef long long LL;
typedef long double LD;
using namespace std;
#define EPS std::numeric_limits<double>::epsilon()
#define max_buf_size 1024

char buf[max_buf_size];
int _bytes_read_ = max_buf_size-1;
char *_s = buf + _bytes_read_;
inline char getc1() { if(_s >= buf + _bytes_read_) { _bytes_read_ = fread(buf,1,max_buf_size-1,stdin); buf[_bytes_read_] = 0;  _s = buf; } return *(_s++); }
inline int readint()
{
	char t=getc1(); int n=1,res=0;
	while(t!='-' && !isdigit(t))
		t=getc1();
	if(t=='-')
	{ n=-1; t=getc1(); }
	while(isdigit(t))
	{ res = 10*res + (t&15); t=getc1(); }
	return res*n;
}
inline LL readLL()
{
	char t=getc1(); int n=1; LL res=0;
	while(t!='-' && !isdigit(t))
		t=getc1();
	if(t=='-')
	{ n=-1; t=getc1(); }
	while(isdigit(t))
	{ res = (LL)10*res + (t&15); t=getc1(); }
	return res*n;
}

inline double readdouble()
{
	// to be implemented
}

inline char skipwhitespace() { char ch = getc1(); while(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1(); return ch; }
inline int readline(char *s)
{
	char ch=skipwhitespace();
	int n=0;
	while( (ch != '\n' && ch != 0) )
	{
		s[n++] = ch;
		ch = getc1();
	}
	s[n] = 0;
	return n;
}

inline int readstr(char *s)
{
	char ch=skipwhitespace();
	int n=0;
	while( (ch != '\n' && ch != ' ' && ch != '\t' && ch != 0) )
	{
		s[n++] = ch;
		ch = getc1();
	}
	s[n] = 0;
	return n;
}

inline char readchar() { return skipwhitespace(); }

char outbuf[max_buf_size];
int outbuf_p;

inline void putc1(char ch) { if(outbuf_p >= max_buf_size) { fwrite(outbuf,1,max_buf_size,stdout); outbuf_p = 0; } outbuf[outbuf_p++] = ch; }

inline void flush() { fwrite(outbuf,1,outbuf_p,stdout); outbuf_p = 0; }

inline void writeint(int n)
{
	int sign = n >= 0 ? 1 : -1;
	n = n>0 ? n : -n;
	char buf[10];
	int i = 9;
	if(!n) buf[i--] = 48;
	while(n)
	{
		buf[i--] = n % 10 + 48;
		n /= 10;
	}
	if(sign < 0) putc1('-');
	while(++i < 10) putc1(buf[i]);
}

inline void writeLL(LL n)
{
	int sign = n >= 0 ? 1 : -1;
	n = n>0 ? n : -n;
	char buf[25];
	int i = 24;
	if(!n) buf[i--] = 48;
	while(n)
	{
		buf[i--] = n % 10 + 48;
		n /= 10;
	}
	if(sign < 0) putc1('-');
	while(++i < 25) putc1(buf[i]);
}

inline void writestr(char *s)
{
	char *p = s;
	while(*p)
	{
		putc1(*p);
		p++;
	}
}

inline void writedouble(double d, int p) { char buf[40]; sprintf(buf,"%.*f",p,d); writestr(buf); }

// END OF IO

vector<string> split(string S, string D)
{
	vector<string> ar;
	int pos = 0, last = 0;
	while( (pos = S.find(D,last)) != string::npos)
	{
		ar.push_back(S.substr(last,pos-last));
		last = pos + D.length();
	}
	ar.push_back(S.substr(last));
	return ar;
}

inline LL pow(LL b, LL e)
{
	LL ans=1;
	while(e--) ans *= b;
	return ans;
}

inline LL pow1(LL b, LL e, LL mod)
{
	LL ans=1;
	while(e)
	{
		if(e & 1)
			ans = ans * b % mod;
		b = b * b % mod;
		e >>= 1;
	}
	return ans;
}

inline LL pow(LL b, LL e, LL mod)	// mod should be prime
{
	if(e < 0)
		return pow1(pow1(b,-e,mod),mod-2,mod);
	else return pow1(b,e,mod);
}

template<class T>
T egcd(T a, T b, T &x, T &y)
{
	if (a == 0)
    {
        x = 0;
        y = 1;
        return b;
    }
    T x1, y1;
    T d = egcd(b%a, a, x1, y1);
    x = y1 - x1* (b/a);
    y = x1;
    return d;
}

LL inv(LL a, LL m)
{
	LL inv,y;
	assert(egcd(a,m,inv,y) == 1);
	if(inv < 0) inv += m;
	return inv;
}

inline LL gcd(LL a, LL b)
{
	while(b)
	{
		LL t = b;
		b = a%b;
		a = t;
	}
	return a;
}

vector<int> getfactors(int n)
{
	vector<int> f;
	for(int a=2;a*a<=n;a++)
	{
		int p = 1;
		while(n % a == 0)
		{
			n /= a;
			p *= a;
		}
		if(p > 1) f.push_back(p);
	}
	return f;
}

inline int getbit(LL n, int i)
{
	return n & (1<<i);
}

int main()
{
	int A[6];
	for(int a=0;a<6;a++) A[a] = readint();
	int B = 2*A[3] + (A[2] + A[4]);
	printf("%d\n", 2*(A[1]+A[2])*B/2 - (A[5]*A[5] + A[4]*A[4] + A[1]*A[1] + A[2]*A[2])/2 );
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <stdio.h>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <queue>
#include <complex>
using namespace std;
#define sc(x)     scanf("%d",&x)
#define scl(x)     scanf("%I64d",&x)

int main() {
	int a1, a2, a3, a4, a5, a6;
	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
	int h = a1 + a1 + 1;
	int ans = 0;
	int x = 0;

	while (x < min(a2,a6))ans += h, h += 2, x++;
	h--;
	while (x < max(a2, a6))ans += h, x++;
	 h = a4 * 2 + 1;
	 x = 0;
	while (x < min(a3,a5))ans += h, h += 2, x++;

	cout << ans << endl;
//		system("pause");

}

#include <cstdio>
int const MAX = 1e3 + 5;
int a[MAX], fac[3 * MAX];

int main()
{
    fac[0] = 1;
    for(int i = 1; i <= 3 * MAX; i++)
        fac[i] = i * i;
    for(int i = 1; i <= 6; i++)
        scanf("%d", &a[i]);
    int ans = fac[a[1] + a[2] + a[3]] - fac[a[1]] - fac[a[3]] - fac[a[5]];
    printf("%d\n", ans);
}

// LUCIFER <3 SLS <3

#include <bits/stdc++.h>

using namespace std;

#define ll long long int

int main()
{
    ll a[6];
    for (int i = 0; i < 6; i++)
        cin >> a[i];
    ll ans = 2*(2*a[0] + a[1] + a[5])*(a[1] + a[2]) - (a[1]*a[1] + a[2]*a[2] + a[4]*a[4] + a[5]*a[5]);
    cout << ans/2 << endl;
    return 0;
}

#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const ll maxn=1e5+5;
const ll inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<int> uid(l, r); return uid(rng); }
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) { return out << "(" << a.F << ", " << a.S << ")"; }
template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
out << "["; for (int i=0;i<v.size();i++) { if(i) out << ", "; out << v[i]; } return out << "]"; }

void solve(){

	ll a1, a2, a3, a4, a5, a6;
	cin>>a1>>a2>>a3>>a4>>a5>>a6;
	ll ans=0;
	for (int i=1;i<=min(a2, a6);i++){
		ans+=2*a1+1;
		a1++;
	}

	a1--;
	for (int i=min(a2,a6)+1;i<=max(a2,a6);i++){
		ans+=2*a1+2;
	}

	for (int i=1;i<=min(a3,a5);i++){
		ans+=2*a1+1;
		a1--;
	}
	cout<<ans<<endl;

	return;
}

int main(){

    #ifndef ONLINE_JUDGE
		//freopen("input.txt", "r", stdin);
    #endif
    srand(time(0));

    ios::sync_with_stdio(0);
    cin.tie(0);

	//T{ solve(); }
	solve();

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int arr[7];
	for (int i = 1; i <= 6; i++)
		cin >> arr[i];

	int x = arr[4] + arr[3] + arr[5];
	x *= x;
	x -= ((arr[1]*arr[1]) +(arr[3]*arr[3]) + (arr[5]*arr[5]));
	cout << x;

    return 0;
}

#include <iostream>
using namespace std;
int main(){
    int a1, a2, a3, a4, a5, a6, a(0), answer(0);
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    a = a1 + a2 + a3;
    cout << a*a - a1*a1 - a3*a3 - a5*a5 << endl;
    return 0;
}

// 487 - Boggle Blitz
#include<iostream>
#include<stdio.h>
#include<vector>
#include<map>
#include <stdlib.h>
#include<algorithm>
#include<set>
#include <fstream>

using namespace std;

int main()
{
    int a1, a2, a3, a4, a5, a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    cout << ((a6 + a5 + a1) * (a1 + a5 + a6)) - (a1 * a1) - (a3 * a3) - (a5 * a5);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){

    /*ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);*/
    int a,b,c,d,e,f,sum=0,val1=0,val2=0;
    cin>>a>>b>>c>>d>>e>>f;

    val1=a*2+1;
    for(int i=0;i<min(b,f);i++)
    {
        sum+=val1;
        val1+=2;
    }
    val1-=2;
    //cout<<sum<<" "<<val1<<"\n";
    val2=d*2+1;
    for(int i=0;i<min(c,e);i++)
    {
        sum+=val2;
        val2+=2;
    }
    val2-=2;
    //cout<<sum<<" "<<val2<<"\n";
        val1++;
    for(int i=0;i<abs(max(b,f)-min(b,f));i++)
    {
        sum+=val1;
    }
    cout<<sum;
    return 0;
}

//Hello. I'm Peter.
#pragma comment(linker, "/STACK:102400000,102400000")
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int a[10];
int main(){
    cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6];
    int l = a[1] + a[2] + a[3];
    int ans = l*l - a[1]*a[1] - a[3]*a[3] - a[5]*a[5];
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifndef M_PI
#define M_PI 3.141592653589793
#endif

#define degToRad(angleInDegrees) ((angleInDegrees) * M_PI / 180.0)

#define x first
#define y second

typedef pair<double, double> point;

double polygon_area(const vector<point> &v) {
	if (v.size() < 3) return 0.0;
	double area = 0.0;
	for (int i = 1; i < v.size(); i++) {
		area += (v[i].y * v[i-1].x) - (v[i].x * v[i-1].y);
	}
	area += (v[0].y * v.back().x) - (v[0].x * v.back().y);
	return std::abs(area/2.0);
}

double currang = 0.0;
double currx = 0.0, curry = 0.0;

void rot_and_scale(double scale) {
	double c = cos(currang);
	double s = sin(currang);

	double xr =  scale * c;
	double yr =  scale * s;

	currx += xr;
	curry += yr;
}

vector<double> xpoints(1, 0.0);
vector<double> ypoints(1, 0.0);

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	for (int i = 0; i < 6; i++) {
		double aux;
		cin >> aux;
		rot_and_scale(aux);
		currang += degToRad(-60.0);
		xpoints.push_back(currx);
		ypoints.push_back(curry);
	}

	vector<point> points;

	for (int i = 0; i < 6; i++) {
		points.push_back(point(xpoints[i], ypoints[i]));
	}

	double area = polygon_area(points);

	cout << fixed << setprecision(0) << round(area / (std::sqrt(3.0)/4.0)) << endl;

	return 0;
}

#include<bits/stdc++.h>

using namespace std;
int main( void )
{
    int a1,b1,c1,d1,e1,f1,big,total,small;
    cin>>a1>>b1>>c1>>d1>>e1>>f1;
    big = (a1 + b1 + c1)*(a1+ b1+ c1);
    small = a1*a1 + c1*c1 + e1*e1;
    cout<<big - small;
    return 0;
}

#include <iostream>
using namespace std;
int a,b,c,d,e,f;
int main(){
    cin >> b >> a >> d >> f >> e >> c;
    if(c < a){
        swap(a,c);
        swap(e,d);
    }
    cout << 2*a*b + 2*(c-a)*(b+a) + 2*f*e + a*a + e*e << endl;
    return 0;
}

#include <bits/stdc++.h>
void debug()
{
    freopen("in.txt" , "r" , stdin) ;
    freopen("out.txt" , "w" , stdout) ;
}

int dx[] {1,-1,0,0} ;
int dy[] {0,0,1,-1} ;

#define ll long long
#define ULL unsigend long long
#define lp(x,n) for(int i = x ; i < n ; i++)
#define sz(v) (int)v.size()
#define adj_list(n) vector<vector<int> > adj_list(n)
#define mapofint map<int,int>
#define mapofchar map<char,int>
using namespace std ;

ll sqr(ll a)
{
    return a * a ;
}

int main()
{
   ll a[6];
   lp(0,6) cin >> a[i] ;
   cout << sqr(a[0] + a[1] + a[2]) - sqr(a[0]) - sqr(a[2]) - sqr(a[4]) << '\n' ;
}

/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=10010;
const int maxm=210;
const int INF=1e9;
const int mod1=1e9+7;
const int mod2=123456701;
int n,m;
double a[maxn];
int main()
{
    int i,j;
    for(i=1;i<=6;i++){
        cin>>a[i];
    }
    double ans=0;
    ans+=0.5*a[1]*a[2]*sqrt(3)*0.5;
    ans+=0.5*a[3]*a[4]*sqrt(3)*0.5;
    ans+=0.5*a[5]*a[6]*sqrt(3)*0.5;
    a[7]=sqrt(a[1]*a[1]+a[2]*a[2]+a[1]*a[2]);
    a[8]=sqrt(a[3]*a[3]+a[4]*a[4]+a[3]*a[4]);
    a[9]=sqrt(a[5]*a[5]+a[6]*a[6]+a[5]*a[6]);
    double gg=(a[7]+a[8]+a[9])*0.5;
    ans+=sqrt(gg*((gg-a[7])*(gg-a[8])*(gg-a[9])));
    ans/=sqrt(3)*0.25;
    printf("%.0lf\n",ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;

//#define endl '\n'

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    cin>>a1>>a2>>a3>>a4>>a5>>a6;

    cout<<(a1+a2+a3)*(a1+a2+a3) - a1*a1 - a3*a3 - a5*a5<<endl;
}

#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
	double x= pow(3, 1.0/2.0);
    int a1, a2, a3, a4, a5, a6;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;

    int side= a3+a4+a5;
    double s_t= x/4;
    double s1= s_t*side*side;
    double s2= s_t*a1*a1;
    double s3= s_t*a3*a3;
    double s4= s_t*a5*a5;

    double t= s1-s2-s3-s4;
    double ans= t/s_t;
    cout<<fixed<<setprecision(0)<<ans;

}

#include<cstdio>
#include<cstring>
#include<cstring>

#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<string>
#include<cmath>

#include<iostream>
using namespace std;

typedef long long ll;
const double PI = acos(-1.0);
const int MOD = 10007;

int main() {
	int a[8];
 	while(scanf("%d",&a[0]) != EOF) {
		for(int i = 1 ; i < 6 ; i ++)	scanf("%d",&a[i]);
		printf("%d\n",(a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]);
 	}
}

//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define mem(p,v) memset(p,v,sizeof(p))
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
const long long inf = 1e18;
double pie = 2*acos(0.0);
void show(vector<lli> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(vector<int> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(int a[], int arraysize){for (int i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(lli a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(bool a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(set<int> s){for (auto it = s.begin(); it != s.end(); it++){cout << *it << " ";}cout<<endl;}
void show(map<lli,lli> mp){for (auto it = mp.begin(); it != mp.end(); it++){cout << it->first << " "<<it->second<<endl;}cout<<endl;}

lli modpow(lli x,lli n){lli res=1;while(n>0){if(n&1) res=((res%MOD)*(x%MOD))%MOD;x=((x%MOD)*(x%MOD))%MOD;n>>=1;}return res;}
lli power(lli x, lli n){lli res=1;while(n>0){if(n&1) res=res*x;x=x*x;n>>=1;}return res;}

/////// ------ Main code starts here ------ /////

void solve()
{
    lli n=6;
    lli a[n];
    lli x,y,mx,ad=0;
    fr(i,0,n)
    {
        cin>>a[i];
    }
    lli ans=pow(a[0]+a[1]+a[2],2)-pow(a[0],2)-pow(a[2],2)-pow(a[4],2);
    cout<<ans<<endl;

}
int main()
{
    run;cout<<fixed<<setprecision(12);
    int t;
    t=1;
    while(t){solve();t--;}
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

const int SZ = 1001001;

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

int main() {
    cin >> a >> b >> c >> d >> e >> f;
    ll total = 2 * (a + 2 * f + e) * (a + b);
    ll subs = a*a + b*b + d*d + e*e;

    cout << (total - subs) / 2;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5;

int main(){
    int a1,a2,a3,a4,a5,a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    int a = a1;int b = a2;int c = a3;int d = a4;
    int s = 0;
    for(int i = a;i <= a+b-1;i++)
        s += 2*i+1;
    for(int i = d;i <= c+d-1;i++)
        s += 2*i+1;
    cout << s << endl;
}

#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const ll maxn=1e5+5;
const ll inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<int> uid(l, r); return uid(rng); }
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) { return out << "(" << a.F << ", " << a.S << ")"; }
template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
out << "["; for (int i=0;i<v.size();i++) { if(i) out << ", "; out << v[i]; } return out << "]"; }

void solve(){

	ll a1, a2, a3, a4, a5, a6;
	cin>>a1>>a2>>a3>>a4>>a5>>a6;
	ll ans=0;
	for (int i=1;i<=a2;i++){
		ans+=2*a1+1;
		a1++;
	}
	a1--;
	for (int i=1;i<=a3;i++){
		ans+=2*a1+1;
		a1--;
	}
	cout<<ans<<endl;

	return;
}

int main(){

    #ifndef ONLINE_JUDGE
		//freopen("input.txt", "r", stdin);
    #endif
    srand(time(0));

    ios::sync_with_stdio(0);
    cin.tie(0);

	//T{ solve(); }
	solve();

	return 0;
}

/*
Author: Qaseem Hasan alias Mikepayne14(Codeforces,Atcoder)
                           qaseem_hasan_ (Codechef,HackerRank,HackerEarth)
*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
//---------------------------------------------------------

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef priority_queue <int, vector<int>, greater<int>> revpq;

const int INF = (int)1e9;
const int EPS = 1e-6;
const int mod  = 1000000007;
const long double PI = 3.14159265359;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

#define acc accumulate
#define eb emplace_back
#define F first
#define S second
#define MP make_pair
#define filcon(v,x) iota(all(v),x)
#define repi(n) for(int i=0;i<n;++i)
//#define erase(v,e) v.erase(std::remove(v.begin(), v.end(), e), v.end())
#define sqr(x) ((x)*(x))
#define MEM(a,b) memset(a, b, sizeof(a))
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b)))
// #define min_all(a,b,c,d,...) min({a,b,c,d,...})
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define make_unique(v) sort(all(v)); v.erase(unique(all(v)), v.end());
#define printv(v) for(auto i:v) cout << i << " "
#define trace(x) cout<<#x<<" = { "<<x<<" }"<<khatam
#define khatam '\n'
#define test int t; cin >> t; repi(t) {solve(); cout << khatam;}
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) \
for ( \
    auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
    blockTime.second; \
    debug("%s: %ld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
)

//--------------------------------------------------------

inline bool grid_inside(int x, int y, int n, int m) {return x >= 1 && x <= n && y >= 1 && y <= m;}

template<typename T>
T lcm(T a,T b)
{
    return (a*b)/__gcd(a,b);
}

template <typename T> T Dis(T x1,T y1,T x2, T y2)
{return sqrt(sqr(x1-x2) + sqr(y1-y2));}

template <typename T> T Angle(T x1,T y1,T x2, T y2)
{return atan((double)(y1-y2) / (double)(x1-x2));}

inline int Set(int N,int pos){ return N=N | (1<<pos);}
inline int Reset(int N,int pos){return N= N & ~(1<<pos);}
inline bool Check(int N,int pos){return (bool)(N & (1<<pos));}
template< class T, class X > inline T togglebit(T a, X i) { T t=1;return (a^(t<<i));}

// right diagonal - r+c 0-based || r+c-1 1-based
// left diagonal - r-c+(n-1) 0-based ||  r-c+n 1-based

//--------------------------------------------------------

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.F < j.F;
}

int LSOne(ll n){
    return log2(n & -n) + 1;
}

int rangeClear(int n,int i,int j){
    int ones = ~0;
    int a = ones << (j+1);
    int b = (i<<2)-1;
    int mask = a|b;
    int ans = n&mask;
    return ans;
}

ll mul_mod(ll x,ll y,ll mod){
    ll i=0,j=x;
    while(y>0){
        if(y&1)
        {
            i = (i+j)%mod;
        }
        j = (j+j)%mod;
        y>>=1;
    }
    return i;
}
ll fast_power(ll a,int x)
{
    if(x==0)
        return 1;
    else if(x==1)
        return a;
    else
    {
        ll R = fast_power(a,x>>1);
        if(!(x&1))
            return R*R;
        else
            return R*a*R;
    }
}

ll fast_power_unlocked(ll a,ll n,ll mod)
{
    ll res = 1;
    while(n > 0)
    {
        if(n&1)
        {
            res = mul_mod(res,a,mod);
        }
        a = mul_mod(a,a,mod);
        n = n >> 1;
    }
    return res;
}

ll modInverse(ll A,ll M)
{
    return fast_power_unlocked(A,M-2,M);
}

/*bool checkPrime(ll n)
{
    int cnt=0;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i == 0)
        {
            if(n/i == i)
                cnt++;
            else
                cnt += 2;
        }
    }

    if(cnt == 2)
        return true;
    else
        return false;
}*/

const int maxn = 755;

/*int find(int x,int* par){
    return x==par[x]?x:par[x] = find(par[x],par);
}

void Union(int x,int y,int* par,int* rnk)
{
    x = find(x,par);
    y = find(y,par);
    if(x == y) return;
    if(rnk[x] > rnk[y])
        rnk[x]+=rnk[y],par[y]=x;
    else
        rnk[y]+=rnk[x],par[x]=y;
}*/

void solve()
{
    unordered_map<int,int> mp;
    int mi = INF;
    int ma = -1;
    for(int i=0;i<6;i++) {int a; cin >>a; mp[a]++; ma = max(a,ma); mi = min(mi,a);}

    ll ans=0;
    if(ma==mi){
        ll c = mp[ma];
        for(ll i=1;i<=ma;i++){
            ans+=(2*i-1)*c;
        }
        cout << ans;
        return;
    }
    for(ll i=mi;i>=1;i--){
        ll count = mp[mi];
        ll side1 = 2*i-1;
        ll side2 = 2*ma-1;
        ma--;
        ans+=side1*count+side2*count;
    }
    ll rem = 2*ma-1;
    for(ll i=rem;i>=1;i-=2){
        ans+=i;
    }
    cout << ans;
}

int main()
{
    FAST_IO;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
//-------------------------------------------------------
        time__("Time Taken"){
        solve();
    }
}

#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <ctime>
#include <iomanip>
#include <iterator>
#include <set>
#include <string>
#include <stack>
#include <cmath>

#define ii <int , int>

#define mp make_pair
#define all(v) v.begin(),v.end()
#define loop(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define sz(v) (int)v.size()
#define X first
#define Y second

#define Pi(x) printf("%d ", (x))
#define Pii(x, y) printf("%d %d ", (x), (y))
#define Piii(x, y, z) printf("%d %d %d", (x), (y), (z))
#define Pl(x) printf("%I64d ", (x))
#define Pll(x, y) printf("%I64d I64d ", (x), (y))
#define Plll(x, y, z) printf("%I64d I64d I64d ", (x), (y), (z))
#define Ps(x) printf("%s", (x))
#define Pe() printf("\n")
#define Pe1(i) for (int j = 0; j < i; j++) printf(" ")

#define Si(x) scanf("%d",&x)
#define Sii(x, y) scanf("%d %d", (&x), (&y))
#define Siii(x, y, z) scanf("%d %d %d", (&x), (&y), (&z))
#define Sl(x) scanf("%I64d", (&x))
#define Sll(x, y) scanf("%I64d %I64d", (&x), (&y))
#define Slll(x, y, z) scanf("%I64d %I64d %I64d", (&x), (&y), (&z))
#define Ss(x) scanf("%s", (&x))

using namespace std;

typedef long long ll;
typedef vector<int > vi;
typedef vector<vi> vvi;
typedef pair ii pii;
typedef vector <pii> vii;
typedef map ii mii;
typedef set <int > si;
typedef multiset <int > msi;
typedef multimap <int , int> mmi;
typedef vector <ll> vl;
typedef pair<ll, ll> pll;
typedef vector <pll> vll;

const ll nInf = -1000000000;
const ll pInf = 1000000000;
const ll mod  = 1000000007;
const int MAXN = 1000;
int a[6];
int sum();

int main()
{
//	freopen( "input.txt", "r" , stdin);
//	freopen( "output.txt", "w" , stdout);
	for (int i = 0;i < 6; i++)
	{
		Si(a[i]);
	}
	ll res = 0;
	while (a[0] + a[1] + a[2] + a[3] + a[4] + a[5] > 0)
	{
		for (int i = 0;i < 6; i++)
		{
			if (a[i] > 0)
			{
				res += 2 * a[i] - 1;
				a[i] --;
			}
		}
		int j = 0;
		int k = -1;//a[0];
		while (k <= 0 && j < 6)
			k = a[j++];
		if (k == 0)
			break;
		int am = 0;
		for (int i = 0;i < 6; i++)
		{
			if (k == a[i])
			{
				am++;
			}
		}
		int am1 = 0;
		for (int i = 0;i < 6; i++)
		{
			if (0 == a[i])
			{
				am1++;
			}
		}

		if (am == 6)
		{
			res += k * k * 6;
			break;//return;
		}
		if (am == 3 && am1 == 3)
		{
			res += k * k;
			break;
		}
	}
	Pi(res);
	return 0;

}

#include<bits/stdc++.h>
using namespace std;
#define INF 1e18
#define f first
#define pii pair<pi,ll>
#define pi pair<ll,ll>
#define pb emplace_back

#define ll long long
#define s second
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define fr freopen("input-4.txt","r",stdin)
#define fo freopen("output-4.txt","w",stdout)
ll func(ll x,ll y){
	return x*(x+2*y);
}
int main(){
	ll a[7];
	rep(i,6)
		cin >> a[i];
	sort(a,a+6);
	if(a[0]==a[5]){
		cout<<2*func(a[0],a[0]);
	}
	else{
		int x=count(a,a+6,a[0]);
		if(x==4){
			cout<<2*func(a[0],a[5]);
		}
		else if(x==2){
			cout<<2*func(a[5],a[0]);
		}
		else if(x==3){
			cout<<func(a[0],a[5])+func(a[5],a[0]);
		}
	}
}

#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <algorithm>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <iostream>

using namespace std;

#define max(a,b) ( a < b ? b : a )
#define min(a,b) ( a > b ? b : a )
#define alter(move) ( ( move + 1 ) % 2 )
#define inf -12345678
#define MAX_SIZE 20000000
#define MOD 1000000007
#define T long long

int main()
{
	T a1, a2, a3, a4, a5, a6;
	T i, sum, t;
	while( cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6  ) {
		t = a1*2 + 1;
		sum = 0;
		for( i=0; i<a2; i++) {
			sum += t;
			t = t + 2;
		}
		t -= 2;
		for( i=0; i<a3; i++ ) {
			sum += t;
			t -= 2;
		}
		cout << sum << endl;
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned long long ull;
#define RI(x) scanf("%d",&x)
#define RII(x,y) scanf("%d%d",&x,&y)
#define RIII(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define DRI(x) int x;RI(x)
#define DRII(x,y) int x,y;RII(x,y)
#define DRIII(x,y,z) int x,y,z;RIII(x,y,z)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define min3(a,b,c) min(a, min(b,c))
#define max3(a,b,c) max(a, max(b,c))
#define sz(a) ((int)a.size())
#define clr(x,a) memset(x, a, sizeof x)
#define REP(i,n) for(int i=0; i<n; ++i)
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define repp(i,a,b) for(int i=a ; i>=b ; --i)
const ll MAX= 5001;
const ll inf=123456789000000000;
const double EPS = 1e-10;
const double PI = 2*asin(1.0);
const ll mod=1e9+7;
inline int cmp(double x, double y = 0, double tol = EPS){return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;}

int main ()
{
	DRII(a, b);

	DRII(x, y);
	DRII(z, w);

	if(x+z<=a)
	{
		if(y<=b && w<=b)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(x+w<=a)
	{
		if(y<=b && z<=b)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(y+z<=a)
	{
		if(x<=b && w<=b)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(y+w<=a)
	{
		if(x<=b && z<=b)
		{
			cout<<"YES\n";
			return 0;
		}
	}

	if(x+z<=b)
	{
		if(y<=a && w<=a)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(x+w<=b)
	{
		if(y<=a && z<=a)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(y+z<=b)
	{
		if(x<=a && w<=a)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	if(y+w<=b)
	{
		if(x<=a && z<=a)
		{
			cout<<"YES\n";
			return 0;
		}
	}

	cout<<"NO\n";
}

#include <bits/stdc++.h>
using namespace std;
int hexa[7];

int main() {
    long long a1,a2,a3,a4,a5,a6;
    cin>>a1>>a2>>a3>>a4>>a5>>a6;
    long long ans= a2*a2 + a1*a2*2 + a3*a3 + 2*a4*a3;
    cout<<ans;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <stack>
#include <bitset>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#define FOP freopen("data.txt","r",stdin)
#define FOP2 freopen("data1.txt","w",stdout)
#define inf_LL 4223372036854775807
#define inf 0x3f3f3f3f
#define maxn 1000010
#define mod 1000000007
#define PI acos(-1.0)
#define LL long long
using namespace std;

int a[10];
LL ans;

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

int judge()
{
    int cnt = 0, cnt1 = 0, res = 0, ma = 0;
    for(int i = 0; i < 6; i++)
    {
        if(a[i] == 0) cnt++;
        if(a[i] == 1) cnt1++;
        ma = max(ma, a[i]);
    }
    if(cnt >= 4) return 1;
    if(cnt == 3)
    {
        if(ma == 2) { ans += 4; return 1; }
        if(ma == 1) { ans++; return 1; }
        ans += 3;
        for(int i = 0; i < 6; i++)
        {
           if(a[i] == 0) a[i] = 1, a[(i+1)%6]--, a[(i-1+6)%6]--;
        }
    }
    if(cnt == 2)
    {
        if(cnt1 == 4) { ans += 2; return 1; }
        if(cnt1 >= 2) { ans += F(ma); return 1; }
        ans += 2;
        for(int i = 0; i < 6; i++)
        {
            if(a[i] == 0) a[i] = 1, a[(i+1)%6]--, a[(i-1+6)%6]--;
        }
    }
    if(cnt == 1)
    {
        for(int i = 0; i < 6; i++)
        {
            if(a[i] == 0) a[i] = 1, a[(i+1)%6]--, a[(i-1+6)%6]--;
        }
    }
    if(cnt == 0)
    {
        for(int i = 0; i < 6; i++)
        {
            ans += F(a[i]);
            a[i]--;
        }
    }

    return 0;
}

int main()
{
    while(~scanf("%d%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
    {
        ans = 0;
        while(1)
        {
            if(judge())break;
        }
        printf("%lld\n", ans);
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int a[6];

int main(void)
{
	ios::sync_with_stdio(false);

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

	int h = a[1] + a[2];
	int c[2] = {a[1], a[5]};
	sort(c, c + 2);

	int ans = (a[0] * 2 + c[0]) * c[0] + (a[0] + c[0]) * (c[1] - c[0]) + (a[3] * 2 + (h - c[1])) * (h - c[1]);
	cout << ans << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define fl(i,a,n) for (int i=a;i<n;i++)
#define rfl(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
template <typename T> T gcd(T a, T b) { return b != 0 ? gcd(b, a % b) : a; }
/*std::cout << std::fixed;
std::cout << std::setprecision(2);*/
int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    int a1,a2,a3,a4,a5,a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    int x = a2;
    int y = a1;
    int s=6;
    int count=2;
    for(int i=1;i<x;i++)
    {
        s+=(3+count*2);
        count++;
    }
    int l = 3+2*(x-1);
    //cout << l;
    for(int i=1;i<y;i++)
    {
        s+=(l+count*2);
        count++;
    }
    cout << s;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

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

    int res = 0, st = (a[0] + 1) * 2 - 1;
    for (int i = 0; i < a[1]; ++i) {
        res += st;
        st += 2;
    }
    st = (a[1] + 1) * 2 - 1;
    for (int i = 0; i < a[0]; ++i) {
        res += st;
        st += 2;
    }
    cout << res;
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
#include <memory.h>

using namespace std;

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

    long long x = a+b+c;

    long long res = x * x - a * a - c * c - c * c;
    cout <<  res << "\n";

    return 0;
}

#include <vector>
  #include <iostream>
  #include<cmath>

   using namespace std;
int main()
{
	int v1[6];
	int a,arc;
	double d,nombre,somme,s1,s2,s3;

	for (int i=0;i<6;i++)
	{
		do
		{
			cin>>a;
		}
		while ( (a<1) || (a>1000));
		v1[i]=a;
	}
	d=(sqrt(3)/4);
	s1=d*v1[0]*v1[0];
	s2=d*v1[2]*v1[2];
	s3=d*v1[4]*v1[4];
	arc=v1[0]+v1[1]+v1[2];
	somme=(sqrt(3)*arc*arc)/4;
	nombre=(somme-s1-s2-s3)/d;
	cout<<(int)nombre<<endl;
	return 0;}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define int long long
#define pb push_back
#define endl "\n"
#define pll pair<int, int>
#define all(a) a.begin(),a.end()
#define bp(n) __builtin_popcount(n)
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef vector< vector< int > > TMatrix;

const ll sz = 2e6+5, mod = 1e9+7;

ll t,n,m,k,q;

int power(int a, int b)
{
	if(b<0)
		b+=mod-1;
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

ll Inv(ll a)
{
    return power(a,mod-2);
}

int fact[1000005],ifact[1000005];
inline int ncr(int n, int r)
{
	if(n<r||r<0||n<0)
		return 0;
	return (((fact[n]*ifact[r])%mod)*ifact[n-r])%mod;
}

void init()
{
    fact[0]=1;
	for(int i=1;i<1000001;i++)
		fact[i]=(fact[i-1]*i)%mod;
	ifact[1000000]=power(fact[1000000],mod-2);
	for(int i=999999; i>=0; i--)
		ifact[i]=(ifact[i+1]*(i+1))%mod;
    return ;
}

signed main()
{
    FIO
    t = 1;
    //cin>>t;
    init();
    while(t--)
    {
        int a,b,c,d,e,f;
        cin>>a>>b>>c>>d>>e>>f;
        int x = 2*a+1;
        int ans = 0;
        for(int i=1;i<=min(b,f);i++)
        {
            ans += x;
            x += 2;
        }
        x--;
        int dif = max(b,f)-min(b,f);
        for(int i=0;i<dif;i++)
            ans += x;
        x = 2*d+1;
        for(int i=1;i<=min(c,d);i++)
        {
            ans += x;
            x += 2;
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
# define M_PI           3.14159265358979323846  /* pi */
using namespace std;

int main(){
int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;
double totA = cos(M_PI/6)*(a*b + 0.5*b*b + d*c + 0.5*c*c);
double triA = 0.5* sqrt(0.75);
cout << totA/triA;
}

#include <bits/stdc++.h>
#define PI = 3.141592654;
using namespace std;
int i , j , k , l;
typedef long long  ll ;
template <class T>
void print(T x[],int size){for(int i=0;i<size;++i)cout<<x[i]<<" ";cout<<endl;}

int main(){
    int a[6] , maxi = 0 , z = 0;
    for (i = 0 ; i < 6 ; ++i)
        cin >> a[i] , maxi = max (maxi , a[i]);
    for (i = 0 ; i < 6 ; ++i)
        for (j = a[i] ; j > -1 ; --j)
            z += j;
    z += (maxi - 1);
    cout << z << endl;
}

#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <set>
//#include <unordered_set>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long LL;
#define rep(i,a,n) for(int i = a; i < n; i++)
#define repe(i,a,n) for(int i = a; i <= n; i++)
#define per(i,n,a) for(int i = n; i >= a; i--)
#define clc(a,b) memset(a,b,sizeof(a))
const int INF = 0x3f3f3f3f;

int main()
{
#ifdef SHY
	freopen("d:\\1.txt", "r", stdin);
#endif
	int a[7];
	repe(i,0,6)
	scanf("%d", &a[i]);
	int mx = max(a[0],a[1]), mi = min(a[0],a[1]);
	printf("%d\n", (mx*mx+mi*mi)*3-2*(mx-mi)*(mx-mi));
	return 0;
}

#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  endl           "\n"
#define  pb             push_back
#define  sym(s)         s="#"+s+"#";
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());

typedef  long long             ll;
typedef  unsigned long long    ull;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   N  =  3e+5+7;

vll adj[N];ll vis[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll a[10],ans;
//<<-----Implement Functions Here---->>//

//<<-----Start of Main--------------->>//
void MAIN(){
		for(ll i=1;i<=6;i++)cin>>a[i];
		ans += ((a[2]+1)*2-1)*2-1 + a[4]*a[4];
		cout<<ans<<endl;

}

int main(){
    fastio;randomINIT;
    //cin>>t;
    while(t--){
        MAIN();
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(i=x;i<=y;i++)
#define _rep(i,x,y) for(i=x;i>=y;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

typedef pair<int,int> pii;
typedef long long ll;

int t[7];
int n,i,j,k,l,p,c,a1,a2,b1,b2,d;

int w(int a,int b){return b*b+2*a*b;}
struct ss{int a[6];}z;
bool W(int a,int b,int c,int d,int e,int f)
{
	z=(ss){a,b,c,d,e,f};
	for(int i=0;i<=5;i++)
	for(int j=i+1;j<=5;j++)
	if(z.a[i]==z.a[j])return 0;
	return 1;
}
int main()
{
	rep(i,1,6)cin>>t[i];

	rep(a1,1,6)
	rep(a2,1,6)
	rep(b1,1,6)
	rep(b2,1,6)
	rep(c,1,6)
	rep(d,1,6)
	if(t[a1]==t[a2]&&t[b1]==t[b2])
	if(W(a1,a2,b1,b2,c,d))
	{
		if(t[c]+t[a1]+t[b1]==t[b1]+t[b1]+t[d])
		{
			printf("%d\n",w(t[c],t[a1])+w(t[d],t[b1]));
			return 0;
		}
	}

	return 0;
}

#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
#define _Clr(x, y) memset(x, y, sizeof(x))
using namespace std;

typedef long long LL;
const int N = 1e5+10;

int main()
{
    int A[10], sum=0;
    for(int i=0; i<6; i++)
    {
        scanf("%d", A+i);
        sum += A[i];
    }
    if(sum==6)
    {
        printf("6\n");
        return 0;
    }
    double l = ((A[1]+A[2])/2.0)*sqrt(3.0);
    double w = A[3] + A[2]/2.0 + A[4]/2.0;
    double s1 = A[1]/2.0*A[1]/2.0*sqrt(3.0)/2.0;
    double s2 = A[2]/2.0*sqrt(3.0)*A[2]/2.0/2.0;
    double s3 = A[4]/2.0*sqrt(3.0)*A[4]/2.0/2.0;
    double s4 = A[5]/2.0*A[5]/2.0*sqrt(3.0)/2.0;
    double s = l*w - s1 - s2 - s3 - s4;
    printf("%d\n", (int)(s/(sqrt(3.0)/4.0)));
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long
#define double long double

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>,
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

class EquiAngPolyGen{
    vector<long int> v;
    long int n, ang;
    vector<pair<double,double>> clockCoordinates;
    const double PI = 3.141592653589793;
    const double epsi = 0.001;

  public:
      EquiAngPolyGen(long int n, vector<long int> &v) : n(n), v(v){
        clockCoordinates.resize(n);
        ang = (n - 2) * 180;
        ang /= n;
      }

      bool testGeneration(){
        clockCoordinates[0] = {0,0};

        long int angle = ang;
        for(long int i = 1; i < n; i++){
            double radians = angle * (PI / 180);
            clockCoordinates[i].first = clockCoordinates[i-1].first + (double)v[i-1] * cos(radians);
            clockCoordinates[i].second = clockCoordinates[i-1].second + (double)v[i-1] * sin(radians);
            angle -= (180 - ang);
        }

        double radians = angle * (PI / 180);
        double t1 = clockCoordinates.back().first * cos(radians);
        double t2 = clockCoordinates.back().second * sin(radians);

        if(fabs(t1 - clockCoordinates[0].first) > epsi || fabs(t2 - clockCoordinates[0].second) > epsi)
          return false;
        return true;
      }

      vector<pair<double,double>> getCC(){
        return clockCoordinates;
      }

      double heron(double a, double b, double c){
        double s = (a + b + c) / 2;
        return sqrt(s * (s - a) * (s - b) * (s - c));
      }

      double getArea(){
        double area = 0;
        for(long int i = 1; i <= n - 2; i++){
            double dis1 = hypot(clockCoordinates[0].first - clockCoordinates[i].first,clockCoordinates[0].second - clockCoordinates[i].second);
            double dis2 = hypot(clockCoordinates[0].first - clockCoordinates[i+1].first, clockCoordinates[0].second - clockCoordinates[i+1].second);
            double dis3 = hypot(clockCoordinates[i].first - clockCoordinates[i+1].first, clockCoordinates[i].second - clockCoordinates[i+1].second);
            area += heron(dis1,dis2,dis3);
        }
        return area;
      }
};

signed main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   vector<long int> v(6), u(3,1);

   for(long int i = 0; i < 6; i++)
      cin>>v[i];

  EquiAngPolyGen hex(6,v), tri(3,u);

  hex.testGeneration();
  tri.testGeneration();

  double area1 = hex.getArea();
  double area2 = tri.getArea();

  cout<<round(area1 / area2);

   return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int in[6],a[6];
    int mini=2000,idx;
    for(int i=0;i<6;i++){
            cin>>in[i];
            if(in[i]<mini)mini=in[i],idx=i;
    }
    for(int i=0,j=idx;i<6;i++,j=(j+1)%6)a[i]=in[j];

    int tot=1;
    for(int i=0;i<a[0];i++)tot+=2;

    for(int i=1;i<a[1];i++)tot+=2;

    long long  res=0;
    for(int i=0;i<min(a[1],a[2]);i++){
        res+=2*tot;
        tot-=2;
    }
     for(int i=0;i<max(a[1],a[2])-min(a[1],a[2]);i++){
        res+=tot;
        tot-=2;
    }
    cout<<res<<"\n";
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
	int n,a,b,c,d,e,f;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	n=a+b;
	printf("%d\n",2*n*n-a*a-d*d);
	return 0;
}

#include <iostream>
using namespace std;
int a[1000000],idx,cnt,ans;
int main(){
    for(int i=1;i<=6;i++){
        cin>>a[i];
        if(i<=3){
            idx+=a[i];
        }
        if(i<=5||i==3){
            cnt+=a[i];
        }

    }

    cnt*=idx;
    for(int i=1;i<=6;i+=2){
        ans+=(a[i]*a[i]);
    }
    cout<<idx-ans<<endl;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int N = 1005;
int n;

int main()
{
	int a1, a2, a3, a4, a5, a6;
	while(~scanf("%d%d%d%d%d%d", &a1, &a2, &a3, &a4, &a5, &a6))
	{
		ll sum = 0;
		int cnt = a1;
		for(int i = 1;  i <= a2; i++)
		{
			sum += 2  * cnt + 1;
			++cnt;
		}
		cnt--;
		for(int i = 1; i <= a3;  i++)
		{
			sum += 2 * cnt + 1;
			--cnt;
		}
		printf("%I64d\n", sum);
	}
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define in(a,x,y) (a>=x && a<=y)
#define out(a,x,y) (!in(a,x,y))
#define sz(a) ((int)a.size())
#define repv(i,a) for(int i=0;i<sz(a);i++)
#define revv(i,a) for(int i=sz(a)-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back

#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define xx first
#define yy second
#define mp make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))

#define LB(a,x) (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x) (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define left nokol_left
#define right nokol_right
#define countbit(x) __builtin_popcountll((ll)x)
#define PQ priority_queue
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;

template<class T>T __sqr(const T x){return x*x;}
template< class T, class X > inline T __pow(T a,X y) {T z=1; rep(i,1,y){z*=a;} return z; }
template< class T > inline T gcd(T a,T b) {a=abs(a);b=abs(b); if(!b) return a; return __gcd(b,a%b);}
template< class T > inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/__gcd(a,b))*b;}
inline bool ispow2(int x){return (x!=0 && (x&(x-1))==0);}
template<class T>void UpdateMin(T &x,T y){  if(y<x){x=y;}}
template<class T>void UpdateMax(T &x,T y){if(x<y){x=y;}}
template<class T,class X, class Y > inline T bigmod(T n,X m,Y mod){ull ret=1, a = n%mod ; while(m){ if(m&1)ret=(ret*a)%mod; m>>=1; a=(a*a)%mod; }ret%=mod;return (T)ret;}
template<class T, class Y > inline T modinv(T n,Y mod) {return bigmod(n,mod-2,mod);}

template<class T,class X> int getbit(T s,X i) { return (s >> i) & 1; }
template<class T,class X> T onbit(T s, X i) { return s | (T(1) << i); }
template<class T,class X> T offbit(T s, X i) { return s & (~(T(1) << i)); }
template<class T> inline void read(T &n){char c;for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar()); n = c - '0';for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';}

void extended_euclid(ll a,ll b,ll &x,ll &y){ if(!b){ x = 1 , y = 0  ;  return ;} ll xx,yy; extended_euclid(b,a%b,xx,yy); x = yy; y = xx - (a/b)*yy; }
pair<ll, pair<ll, ll> > extendedEuclid(ll a, ll b) { ll x = 1, y = 0; ll xLast = 0, yLast = 1; ll q, r, m, n; while(a != 0) {q = b / a; r = b % a; m = xLast - q * x; n = yLast - q * y; xLast = x, yLast = y; x = m, y = n; b = a, a = r; } return make_pair(b, make_pair(xLast, yLast)); }

const ll mod[]  ={0,1000000007,1000000009,1000000021,1000000033,1000000097,1000000093,1000000097,1000000103};
const ll base[] ={0,1000003,1000033,1000037,1000039,1000081,1000099,1000117,1000121};

#define eps  1e-9
#define MX   (lmt + 20 )
#define inf  2000000000LL
#define MOD  1000000007
//---------->0123456789123465789
#define lmt  200000

int a[10];

int main()
{
    set<int>s;
    rep(i,1,6)
        {
            scanf("%d",a+i);
            s.insert(a[i]);
        }
//
//    if(s.size()==3){
//        cout<<"0"<<endl;
//        return 0;
//    }

    if(s.size()==3){
        sort(a+1,a+4);
        sort(a+4,a+7);
    }
    else{
        sort(a+1,a+3);
        sort(a+3,a+5);
        sort(a+5,a+7);
    }

//    rep(i,1,n){
//        cout<<
//    }

    ll tot = 0 , st = a[1] ;
    ll last = 0;
    rep(i,1,a[2]){
        tot += st + (st + 1);
        last = st + st + 1;
        st++;
    }

    if(a[2]<a[3]){
            last += 1;
            tot = tot*2 + (ll)last*(a[3] - a[2]);
    }
    else{
        rep(i,1,a[1]){
            tot += st + (st-1);
            st--;
        }
    }
    cout<<tot<<endl;

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=1009;

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

#include <iostream>

using namespace std;

int main()
{
    int A[6];
    for (int i = 0; i < 6; i++)
        cin >> A[i];
    int a = 2 * A[0] + A[3];
    int b = A[0] * A[0];
    cout << a*a - 3*b*b;
    return 0;
}

/* Have courage and be kind*/
#include<bits/stdc++.h>
#include<stdlib.h> //system("pause");
using namespace std;
#define inf (1<<29)
#define SET(a) memset(a,-1,sizeof(a))
#define all(a) a.begin(),a.end()
#define CLR(a) memset(a,0,sizeof(a))
#define FILL(a,v) memset(a,v,sizeof(a))
#define PB push_back
#define FOR0(i,n) for(int i = 0;i<n;i++)
#define FOR1(i,n) for(int i = 1;i<=n;i++)
#define ABS(x) ((x)<0?-(x):(x))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define pi ((double)2*acos(0.0))
#define PI acos(-1.0)
#define sq(x) ((x)*(x))
#define EPS 1e-9
#define UNIQUE(V) (V).erase(unique((V).begin(),(V).end()),(V).end())//vector must be sorted
#define min3(a,b,c) min(a,min(b,c))
#define maxx3(a,b,c) maxx(a,maxx(b,c))
#define NUMDIGIT(x,y) (((int)(log10((x))/log10((y))))+1)
#define LCM(x,y) (((x)/gcd((x),(y)))*(y))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define lol long long
#define ulol unsigned long long
#define pf printf
#define sf scanf
#define bin2dec(b,d) for(int i=0,d=0;b[i];d=(d<<1)|(b[i++]-48));
#define dec2bin(d,b) int nnn=d;while(nnn){if(nnn%2)b+="1";else b+="0";nnn>>=1;}reverse(ALL(b));
#define fast_add(x,y) while(y){typeof(x) carry = x & y;x=x^y;y=carry<<1;} //answer is x
#define sz 100000
#define mod 1000000007 //10^9+7

///int rrr[]={1,0,-1,0};int ccc[]={0,1,0,-1}; //4 Direction
///int rrr[]={1,1,0,-1,-1,-1,0,1};int ccc[]={0,1,1,1,0,-1,-1,-1};//8 direction
///int rrr[]={2,1,-1,-2,-2,-1,1,2};int ccc[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
///int rrr[]={2,1,-1,-2,-1,1};int ccc[]={0,1,1,0,-1,-1}; //Hexagonal Direction
///int month[]={31,28,31,30,31,30,31,31,30,31,30,31}; //month
///string monthArray[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
///string dayArray[]={"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};//Day
/// for(map<int,int>::iterator i=mp.begin();i!=mp.end();i++)cout<<i->first<<" "<<i->second<<endl;
/// vector< pair<string,string> > result;  result.push_back(make_pair(words[i].word, words[j].word));
///nCr[0][0]=1; for(int i=1;i<1002005;i++){ nCr[i][0]=1; for(int j=1;j<=i;j++) nCr[i][j]=nCr[i-1][j]+nCr[i-1][j-1];}

lol mod_v(lol num)
{
    if(num>=0)
      return(num%mod);
    else
     return(num%mod+mod)%mod;
}

lol fast_pow(lol b,lol p,lol md)
{
    lol r=1%md; // if mo==1 the r should be equal to 0
    while(p>0)
    {
        if(p%2==1)
          r=(r*b)%md;
        p=p/2;
        b=(b*b)%md;
    }
    return r;
}
int countBits(int n)
{
    int sum=0;
    while(n>0)
    {
        if(n & 1 == 1) sum++;
        n=n>>1;
    }
    return sum;
}
lol gcd(lol a, lol b)
{
    a=abs(a);b=abs(b);
    while(b)
    {
        a=a%b;
        swap(a,b);
    }
    return a;
}

vector<int> prime; /*Stores generated primes*/
char sieve[sz]; /*0 means prime*/
void primeSieve ( int n ) {
    sieve[0] = sieve[1] = 1; /*0 and 1 are not prime*/

    prime.push_back(2); /*Only Even Prime*/
    for ( int i = 4; i <= n; i += 2 ) sieve[i] = 1; /*Remove multiples of 2*/

    int sqrtn = sqrt ( n );
    for ( int i = 3; i <= sqrtn; i += 2 ) {
        if ( sieve[i] == 0 ) {
            for ( int j = i * i; j <= n; j += 2 * i ) sieve[j] = 1;
        }
    }

    for ( int i = 3; i <= n; i += 2 ) if ( sieve[i] == 0 ) prime.push_back(i);
}
/********** Solution ***************/
int main()
{
    //READ("input.txt");
    lol n,cnt=0;
    lol arr[6]={0};
    for(lol i=0;i<6;i++)
     sf("%I64d",&arr[i]);
    lol ans=0;
    ans=2*arr[0]+1;
    cnt=2*arr[0]+1;
    //cout<<ans<<endl;
    for(lol i=1;i<min(arr[1],arr[5]);i++)
    ans+=(cnt+i*2);
    //cout<<ans<<endl;
    ans+=(arr[3]*2)+1;
    cnt=(arr[3]*2)+1;
    //cout<<ans<<endl;
    for(lol i=1;i<min(arr[2],arr[4]);i++)
    ans+=(cnt+i*2);
    pf("%I64d\n",ans);
    return 0;
}

#include <stdio.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <iostream>
#include <algorithm>

#define SIZE 1000

typedef long long ll;

using namespace std;

ll a[6], ans = 0;

int main(){

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

    for (int tr = 0; tr < 6; tr++){

        ll tmp = a[0];
        for (int i = 0; i < 5; i++) a[i] = a[i + 1];
        a[5] = tmp;

        if (a[1] == a[5] && a[2] == a[4]){

            ll cur = a[0] * 2 + 1;

            for (int i = 1; i <= a[1]; i++){
                ans += cur;
                cur += 2;
            }

            for (int i = 1; i <= a[2]; i++){
                cur -= 2;
                ans += cur;
            }

            cout << ans;

            return 0;
        }

    }

    if (ans == 0){

        ll cur = a[0] * 2 - 1;
        if (a[1] > a[5]){
            swap(a[1], a[5]);
            swap(a[2], a[4]);
        }

        for (int i = 0; i < a[1]; i++){
            cur += 2;
            ans += cur;
        }

        ans *= 2;

        cur++;
        ans += cur * (a[5] - a[1]);

        cout << ans;

    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int qian[1005],a[7];
int solve(int x,int y)
{
//	cout<<x<<' '<<y<<endl;
	int z=x+y;
	return qian[z]-qian[x];
}

int main()
{
	for(int i=1;i<=1000;i++)qian[i]=qian[i-1]+i*2-1;
	for(int i=1;i<=6;i++)scanf("%d",&a[i]);
	int ans=0;
	for(int i=1;i<=3;i++)
	{
		while(min(a[i],a[i+3])>1)
		{
			a[i]--;a[i+3]--;
			ans+=a[i+1]+a[i+2];
		}
	}
	ans+=solve(a[1],a[2])+solve(a[4],a[5]);
	printf("%d\n",ans);
	return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define decimal(x) cout<<fixed<<setprecision(x);
void solve()
{
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    float ta=sqrt(3)*a*b*1.0+sqrt(3)*pow(a,2)/4.0+sqrt(3)*pow(b,2)/4.0;
    float i=ta/(sqrt(3)/4.0);
    cout<<i<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
}

#include<iostream>
using namespace std;
int main() {
	int a[6];
	for(int i = 0; i < 6; i++) {
		cin >> a[i];
	}
	int min = a[0] > a[1] ? a[1] : a[0];
	int max = a[0] > a[1] ? a[0] : a[1];
	cout << (max+min)*(max+min) - min*min*3 << endl;
	return 0;
}

/*
Author: richard
Contact: zhangruichang112@gmail.com
*/
#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<ctime>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<fstream>
#include<sstream>
#include<iostream>
#include<algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
const int maxn = 1e6 + 10;
typedef long long LL;
typedef unsigned long long ULL;
//int, -2^31~2^31-1    -2.1*10^9~2.1*10^9 (-2147483648-2147483647)
//unsigned int, 0~2^32-1  0~4.2*10^9
//long long  -2^63~2^63-1 -9*10^18~9*10^18
//unsigned long long 0~2^64-1  0~1.8*10^19
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define iOS  ios_base::sync_with_stdio(false)
int getint(){
    int t = 0, flag = 1; char c = getchar();
    while (c<'0' || c>'9' || c == '-')
    {
        if (c == '-')
            flag = -1;
        c = getchar();
    }
    while (c >= '0'&&c <= '9')
        t = t * 10 + c - '0', c = getchar();
    return t*flag;
}
int GCD(int m, int n)
{
    return !m ? n : GCD(n%m, m);
}
template <typename T>
string to_string(T value)
{
  //create an output string stream
  ostringstream os ;

  //throw the value into the string stream
  os << value ;

  //convert the string stream into a string and return
  return os.str() ;
}
LL MultMod(LL a,LL b,LL MOD)
{
    a %= MOD;
    b %= MOD;
    LL ret = 0;
    while(b){
        if (b & 1){
            ret += a;
            if(ret >= MOD) ret -= MOD;
        }
        a = a << 1;
        if (a >= MOD) a -= MOD;
        b = b >> 1;
    }
    return ret;
}
int a[maxn], n, t, m;
int main()
{
/*
#ifndef ONLINE_JUDGE
    freopen ("in.txt" , "r" , stdin);
    freopen ("out.txt" , "w" , stdout);
#endif
*/
    for(int i=1;i<=6;i++) cin>>a[i];
    cout<<2*a[3]*a[4]+a[3]*a[3]+2*a[1]*a[2]+a[2]*a[2]<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int main(){
    int x,y,z,a,b,c;
    cin >> x >> y >> z >> a >> b >> c;
    int t = x+ y+z;

    cout << t*t - x*x -z*z - c*c  << endl;
    return 0;
}

#include<iostream>
int main(){int a,b,c,d;std::cin>>a>>b>>c>>d;std::cout<<a*a-d*d+2*(a*c+b*c+a*d+b*d-c*c);}

#define _CRT_SECURE_NO_WARNINGS
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <time.h>
#include <string>
#include <vector>
#include <math.h>
#include <cassert>
#include <iostream>
#include <algorithm>

using namespace std;

#define ft first
#define sc second
#define mp make_pair
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)

typedef long long li;
typedef long double ld;
typedef pair <li, li> pli;
typedef pair <int, int> pii;

int ans, c[6];

void main()
{

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    forn(i, 6)
        cin >> c[i];

    sort(c, c + 6);

    int dans = 0, cnt = c[3];

    forn(i, c[0])
        ans += (2 * cnt + 1), cnt++;

    if(c[3] == c[0])
        cout << 2 * ans;
    else
    {
        cnt = c[0];

        if(c[2] == c[0])
            forn(i, c[3] - c[0])
                dans += (2 * cnt + 1), cnt++;
        else
            forn(i, c[3] - c[0])
                dans += (2 * cnt + 1) * 2, cnt++;

        cout << 2 * ans + dans;
    }
}

#include<bits/stdc++.h>
using namespace std;

int main(){
	int a[6];
	for(int i=0;i<6;i++) cin>>a[i];
	int minIndex = 0;
	for(int i=0;i<6;i++){
		if(a[i] < a[minIndex]){
			minIndex = i;
		}
	}
	int b[6];
	for(int i=minIndex,j=0;j<6;j++){
		b[j] = a[i];
		i = (i+1)%6;
	}
	int start = b[0]+b[1];
	int end = b[1];
	long long int total = 0;
	for(int i=start;i>end;i--){
		total += 2*i-1;
	}
	int rem = b[2] - b[0];
	for(int i=0;i<rem;i++){
		total += 2*start-1;
	}
	start = b[3]+b[4];
	end = b[4];
	for(int i=start;i>end;i--){
		total += 2*i-1;
	}
	cout<<total<<endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int area(int A[6]){
	int z = 0;
	for(int i=0;i<6;i++){
		if(A[i] != 0){
			z++;
		}
	}
	if(z != 6){
		switch(z){
			case 3:
				return 1;
			case 4:
				return 3;
			case 5:
				return 5;
			default:
				return 0;
		}
	}
	int ret = 0;
	int B[6];
	for(int i=0;i<6;i++){
		ret += 2*A[i]-1;
		B[i] = A[i]-1;
	}
	ret += area(B);
	return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int A[6];
	for(int i=0;i<6;i++){
		cin >> A[i];
	}
	cout << area(A) << '\n';

	return 0;
}

//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <stdio.h>
//end of libraries ;
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define LNF 3999999999999999999
#define INF 999999999
#define N 3000003
#define PI 3.14159265359
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define mkp(a,b) make_pair(a,b)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int a[7] , ans;
int main(){
fcin;
    for(int i = 0 ; i < 6 ; i++){
        cin >> a[i];
        ans += (a[i] + (a[i]-1));
    }
    int b = min(a[5] , a[1]);
    b = min(b , a[3]);
    b--;
    while(b>0){
        ans += b;
        b--;
    }
    cout << ans << '\n';

}

/*
ID: lisa.va1
PROG: test
LANG: C++11
*/
#include <cstdio>
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define trav(it, v) for(auto it = (v).begin(); it != (v).end(); ++it)

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
typedef long long ll;

double degsin(double a) {
	a = a/180*M_PI;
	return sin(a);
}

double degcos(double a) {
	a = a/180*M_PI;
	return cos(a);
}

double getArea(vector<double> x, vector<double> y) {
	double area = 0;
	int j = 5;
	rep(i, 0, 6) {
		area += (x[i]+x[j])*(y[j]-y[i]);
		j = i;
	}
	area /=2;
	return area;
}

int main(){
     vi side(6);
     rep(i, 0, 6) {
        cin >> side[i];
     }
     vector<double> x(6);
     vector<double> y(6);
     double curx, cury, angle;
     curx = cury = angle = 0;
     rep(i, 0, 6) {
     	x[i] = curx;
     	y[i] = cury;
     	curx = curx + side[i]*degcos(angle);
     	cury = cury + side[i]*degsin(angle);
     	angle += 60;
     }

     double area = getArea(x, y);

     double triangle = sqrt(3)/4;
     area = -area;
     cout << ceil(area/triangle) << endl;
}

#include<bits/stdc++.h>
#define MOD 1000000007
#define MAX 100005
#define P 1 << 15
#define ll long long
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define slld(t) scanf("%lld",&t)
#define plld(t) printf("%lld\n",t)
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define eph 0.0000000001
#define slf(x) scanf("%0.12lf",&x)
#define plf(x) printf("%0.12lf\n",x)
using namespace std;

struct cmp
{
    bool operator()(pii a ,pii b){
        return a.second > b.second;
    }
};

ll modpow(ll base, ll exp, ll mod)
{
  base %= mod;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}

ll num[6];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("C:/Users/HP/Desktop/codejam/1A_large_input.txt","r",stdin);//redirects standard input
	//freopen("C:/Users/HP/Desktop/codejam/1A_large_output.txt","w",stdout);//redirects standard output
	for(int i=0; i<6; i++)
	{
		slld(num[i]);
	}
	ll ans=0,a,d=2,n;
	sort(num,num+6);
	n=num[5];
	a=2*num[0]+1;

	int c=1;
	for(int i=4; i>=0; i--)
	{
		if(num[i]==n) c++;
	}

	if(c==6 || c==4) {
		ans=n*(2*a+(n-1)*d);
	}
	else if(c==2) {
		n=num[0];
		ans=n*(2*a+(n-1)*d);
		a=a+1+(n-1)*d;
		n=num[5]-num[0];
		ans+=a*n;
	}
	else {
		ans=(n*(2*a+(n-1)*d));
		n=num[5]-num[0];
		//cout<<" "<<n<<" "<<ans<<endl;
		ans-=(n*(2*a+(n-1)*d))/2;
	}

	plld(ans);

	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#define MP make_pair
#define PB push_back
#define SZ(x) int((x).size())
#define SQR(x) (x)*(x)
#define SIGN(x) (x>1)-(x<0)
typedef long long LL; typedef unsigned long long ULL; typedef long double LD; typedef pair<int,int> pii; typedef pair<long,long> pll; typedef vector<int,int> vii;
const LD PI = 3.1415926535897932384626433832795L; const LD EPS = 1e-9;
LL gcd (LL a, LL b) {while(b){a %= b;swap (a, b);}return a;} LL lcm(const LL a,const LL b){return a/gcd(a,b)*b;}LL sign(const LL x){return (x>0)-(x<0);}
template<class T>const T sqr(const T x){return x*x;}
template<class T> const T binpow(const T a, const ULL n, const T modulo){return n == 0 ? 1 : sqr ( binpow ( a, n/2, modulo ) ) % modulo * ( n % 2 ? a : 1 ) % modulo;}

struct Point
{
	LD x, y;
	Point(const LD x = 0, const LD y = 0, const bool type = false) :x(type ? x * cos (y) : x), y(type ? x * sin(y) : y){}
	void rotate(const LD angle)
	{
		*this = Point(x * cos(angle) - y * sin(angle), y * cos(angle) + x * sin(angle));
	}
};
Point operator + (const Point &a, const Point &b){ return Point(a.x + b.x, a.y + b.y); }
Point operator - (const Point &a, const Point &b){ return Point(a.x - b.x, a.y - b.y); }
LD operator * (const Point &a, const Point &b){ return a.x * b.y - a.y * b.x; }
Point operator * (const int &a, const Point &b){ return Point(a * b.x, a * b.y); }

const int N = 6;
int a[N];

Point heaps[N];

int main ( ) {
    ios::sync_with_stdio ( false );

	LL area = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
	}

	heaps[0] = Point(0, 0, false);
	for (int i = 1; i < N; i++)
	{
		Point direction = Point(a[i - 1], PI / 6 * i, true);
		heaps[i] = heaps[i - 1] + direction;
	}

	for (int i = 2; i < N; i++)
	{
		Point first = heaps[i - 1] - heaps[0];
		Point second = heaps[i] - heaps[0];
		area += abs(first * second);
	}

	cout << LL(area / sin(PI / 3)) << endl;

    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define ft first
#define sd second
#define sort(x) sort(x.begin(), x.end())
#define fq(i, n) for(int i=0;i<n;i++)
#define fw(i, n) for(int i=1;i<=n;i++)
#define fe(i, n) for(int i=n;i>0;i--)
#define fy(i, n) for(int i=n-1;i>=0;i--)
#define sor(a, h) sort(a, a+h)
#define sync ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lb lower_bound
#define ub upper_bound
#define ins insert
using namespace std;
typedef pair <int,int> pii;
typedef long long ll;
typedef vector <int> vi;
typedef vector <pii> vp;
typedef set <int> si;
typedef set <pii> sp;
typedef queue <int> qi;
typedef set <int>::iterator siit;
typedef const int ci;
ll a,b,maj;

int main(){
	cin>>a>>b;
	if(a>b)
	swap(a,b);
	cout<<(b+2)*(b+2)-3*(a*a);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <time.h>
#define ll long long
#define stdp pair <int,int>
#define mod 1000000007
using namespace std;

FILE *file;

int gcd(int a, int b)
{
	if (b == 0)
	{
		return a;
	}
	else
	{
		return gcd(b, a%b);
	}
}

int main()
{
	//freopen_s(&file, "input.txt", "r", stdin);
	int s[12];
	for (int i = 0; i < 6; i++)
	{
		cin >> s[i];
	}
	for (int i = 0; i < 6; i++)
	{
		s[i + 6] = s[i];
	}
	int i = 0;
	while (s[i] != s[i + 2])
	{
		i++;
	}
	int b = s[i];
	int a = s[i+1];
	int c = a + b;
	int res = 0;
	while (a < c)
	{
		res += 2 * a + 1;
		a++;
	}
	 b = s[i+3];
	 a = s[i+4];
	 c = a + b;
	while (a < c)
	{
		res += 2 * a + 1;
		a++;
	}

	cout << res;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifndef M_PI
#define M_PI 3.141592653589793
#endif

#define degToRad(angleInDegrees) ((angleInDegrees) * M_PI / 180.0)

#define x first
#define y second

typedef pair<double, double> point;

double polygon_area(const vector<point> &v) {
	if (v.size() < 3) return 0.0;
	double area = 0.0;
	for (int i = 1; i < v.size(); i++) {
		area += (v[i].y * v[i-1].x) - (v[i].x * v[i-1].y);
	}
	area += (v[0].y * v.back().x) - (v[0].x * v.back().y);
	return std::abs(area/2.0);
}

double currang = 0.0;
double currx = 0.0, curry = 0.0;

void rot_and_scale(double scale) {
	double c = cos(currang);
	double s = sin(currang);

	double xr =  scale * c;
	double yr =  scale * s;

	currx += xr;
	curry += yr;
}

vector<double> xpoints(1, 0.0);
vector<double> ypoints(1, 0.0);

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	for (int i = 0; i < 6; i++) {
		double aux;
		cin >> aux;
		rot_and_scale(aux);
		currang += degToRad(-60.0);
		xpoints.push_back(currx);
		ypoints.push_back(curry);
	}

	vector<point> points;

	for (int i = 0; i < 6; i++) {
		points.push_back(point(xpoints[i], ypoints[i]));
	}

	double area = polygon_area(points);

	cout << round(area / (std::sqrt(3.0)/4.0)) << endl;

	return 0;
}

#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define limit 100005
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define forup(i,a,b) for(int i=a; i<b; ++i)
#define fordn(i,a,b) for(int i=a; i>b; --i)
#define rep(i,a) for(int i=0; i<a; ++i)
#define dforup(i,a,b) for(i=a; i<b; ++i)
#define dfordn(i,a,b) for(i=a; i>b; --i)
#define drep(i,a) for(i=0; i<a; ++i)
#define gi(x) scanf("%d",&x)
#define gl(x) scanf("%lld",&x)
#define gd(x) scanf("%lf",&x)
#define gs(x) scanf("%s",x)
#define pis(x) printf("%d ",x)
#define pin(x) printf("%d\n",x)
#define pls(x) printf("%lld ",x)
#define pln(x) printf("%lld\n",x)
#define pds(x) printf("%.12f ",x)
#define pdn(x) printf("%.12f\n",x)
#define pnl() printf("\n")
#define fs first
#define sc second
#define pb push_back
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int T;
    T=1;
	// cin>>T;
	// cin.ignore(); must be there when using getline(cin, s)
	while(T--)
	{
        ll a[6];
        rep(i,6)
            cin>>a[i];
        ll ans =0;
        while(1)
        {
            ll ct=0;
            ll mx=0;
            ll mn = 10001;
            rep(i,6)
            {
                if(a[i]==0)
                    ct++;
                if(a[i]!=0)
                    mn = min(mn,a[i]);
                mx = max(mx,a[i]);
            }
            if(ct>3)
                break;
            if(ct==3)
            {
                ans+=mx*(mx+1)-mx;
                break;
            }
            if(ct==2)
            {
                ans+=2*mx*mn;
                break;
            }
            if(ct==1)
            {
                rep(i,6)
                {
                    if(a[i]==0)
                    {
                        ans+=1;
                        a[i]=1;
                        a[(i+1)%6]--;
                        a[(i-1+6)%6]--;
                    }
                }
            }
            if(ct==0)
            {
                rep(i,6)
                {
                        ans+=2*a[i]-1;
                        a[i]--;
                }
            }
        }
        pin(ans);
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int arr[8];

    cin>>arr[1]>>arr[2]>>arr[3]>>arr[4]>>arr[5]>>arr[6];

    int tringles=0,pos=1;

    for(int i=1;i<=3;++i)
    {
        if(arr[i]!=arr[i+2])
            pos=0;
    }

    if(pos)
    {
    int multi=arr[5];

    for(int i=1;i<=arr[6];++i)
    {
        tringles+=(multi*2);
        tringles++;
        multi++;
    }

    multi=arr[2];

    for(int i=1;i<=arr[1];++i)
    {
        tringles+=(multi*2);
        tringles++;
        multi++;
    }

    }

    cout<<tringles<<endl;

    return 0;
}

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;

int main()
{
    int a1, a2, a3, a4, a5, a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    int sum = 0;
    for( int i = 0; i < min(a2, a6); i ++ )
    {
        sum += 2 * a1 + 1;
        a1 ++;
    }
    for( int i = 0; i < min(a3, a5); i ++ )
    {
        sum += 2 * a4 + 1;
        a4 ++;
    }
    sum = sum + a4*(a2 + a3 - min(a3, a5) - min(a2, a6));
    cout << sum ;
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using std::vector;

int a[7];

int main() {
    int ret = 0;

    for (int i = 1; i <= 6; i++)
    {
        cin >> a[i];
    }

    for (int i = a[1]; i < a[1] + a[2]; i++)
    {
        ret += 2 * i + 1;
    }

    for (int i = a[3]; i < a[3] + a[4]; i++)
    {
        ret += 2 * i + 1;
    }

    ret -= 1;

    for (int i = a[6] - a[2]; i < a[6] + a[5] - a[2]; i++)
    {
        ret += 2 * i + 1;
    }

    cout << ret;

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<math.h>
#include<cctype>
#define ll long long
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define REPP(i,a,b,t) for(int (i)=(a);(i)<=(b);(i)+=(t))
#define rep(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define repp(i,a,b,t) for(int (i)=(a);(i)>=(b);(i)-=(t))
#define PII pair<int,int>
#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define RI(x) scanf("%d",&(x))
#define RII(x,y) scanf("%d%d",&(x),&(y))
#define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define DRI(x) int (x);scanf("%d",&(x))
#define DRII(x,y) int (x),(y);scanf("%d%d",&(x),&(y))
#define DRIII(x,y,z) int (x),(y),(z);scanf("%d%d",&(x),&(y),&(z))
#define RS(x) scanf("%s",x)
#define RSS(x,y) scanf("%s%s",x,y)
#define DRS(x) char x[maxn];scanf("%s",x)
#define DRSS(x,y) char x[maxn],y[maxn];scanf("%s%s",x,y)
#define MS0(a) memset((a),0,sizeof((a)))
#define MS1(a) memset((a),-1,sizeof((a)))
#define MS(a,b) memset((a),(b),sizeof((a)))
#define ALL(v) v.begin(),v.end()
#define SZ(v) (int)(v).size()

using namespace std;

const int maxn=1000100;
const int INF=(1<<29);
const double EPS=0.0000000001;
const double Pi=acos(-1.0);

ll a[10],b[10];

ll f(ll x)
{
    return x*x;
}

void jud()
{
    //REP(i,0,5) cout<<a[i]<<" ";cout<<endl;
    REP(k,0,6){
        if(a[0]==a[2]&&a[3]==a[5]) break;
        REP(i,0,5) b[(i+1)%6]=a[i];
        REP(i,0,5) a[i]=b[i];
    }
    //REP(i,0,5) cout<<a[i]<<" ";cout<<endl;
}

int main()
{
    REP(i,0,5) cin>>a[i];
    jud();
    ll ans=2*f(a[0]+a[1])-f(a[1])-f(a[4]);
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>

#define ll long long int
#define vii  vector<int>::iterator
#define vli  vector<ll>::iterator
#define vi  vector<int>
#define vl  vector<ll>
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define MOD 1000000007
#define in cin>>
#define i2(x,y) cin>>x>>y
#define i3(x,y,z) cin>>x>>y>>z
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<endl
#define o2(x,y) cout<<x<<' '<<y<<endl
#define o3(x,y,z) cout<<x<<' '<<y<<' '<<z<<endl
#define pn cout<<endl
#define F first
#define S second
#define for_it(it, X) for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define op(X) cout<<X.F<<" "<<X.S<<" " ;
#define opn(X) cout<<X.F<<" "<<X.S<<endl;

using namespace std;

int main() {
    int a[7];
    for(int i=0;i<6;i++)
        cin>>a[i];
    cout<<pow(a[0]+a[1]+a[2],2)-pow(a[0],2)-pow(a[2],2)-pow(a[4],2)<<endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define LL long long
int main()
{
    LL k,ans, res, tmp, a[10], b[10];
    while(cin>>a[0])
    {
        ans = 0, k = 0;
        for(int i=1; i<6; i++)
            cin>>a[i];
        for(int i=6; i<12; i++)
            a[i] = a[i-6];
        for(int i=1; i<=6; i++)
        {
            if(a[i]==a[i+4]&&a[i+1]==a[i+3])
            {
                for(int j=i-1; j<i+5; j++)
                    b[k++] = a[j];
                break;
            }
        }
        for(int i=b[0]; i<b[0]+b[1]; i++)
            ans += 2*i+1;
        for(int i=b[3]; i<b[3]+b[2]; i++)
            ans += 2*i+1;
        cout<<ans<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define f first
typedef pair<int,int> ii;
typedef pair<int,pair<int,int> > iii;

double heron(double a, double b, double c)
{
    double s = (a+b+c)/2.0;
    s=sqrt(s*(s-a)*(s-b)*(s-c));
    return s;

}

int main(int argc, const char * argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int A[7];
    int i;
    int a1,a2;

    for(i=0;i<6;i++)
        cin>>A[i];

    vector<double> V;
    double x;
    double ar = 0;

    for(i=0;i<6;i=i+2)
    {
        a1=A[i];
        a2=A[i+1];
        x=sqrt(a1*a1 + a2*a2 + a1*a2);
        ar = ar+heron(a1,a2,x);
        V.pb(x);
    }

    ar = ar+heron(V[0],V[1],V[2]);
    ar = ar/double(sqrt(3));
    ar = ar*4.0;

    cout<<(int)ar;

    return 0;
}

#include <bits/stdc++.h>

long long calc(int a, int b, int c) {
    b = b*2+1;
    c = b+(a-1)*2;
    return (long long)(c+b)*a/2;
}

long long calc2(int a, int b) {
    return (long long)a*b*2;
}

int main() {
    int a[6];
    for (int i = 0; i < 6; i++) scanf("%d", a+i);
    printf("%I64d", calc(a[0], a[1], a[2])+calc(a[3],a[4],a[5])+calc2(std::min(a[0],a[2])+a[1], std::abs(a[0]-a[2])));
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int tt = 0, x;
    for (int i=1 ; i<=6 ; i++)
    {
        scanf("%d", &x);
        tt += x;
    }

    double r = (double) tt / 6;
    printf("%.0lf", floor(r * (double)tt));
    return 0;
}

#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
#include <set>
#include <cstring>
#include <map>

using namespace std;

int main()
{
    vector<int> v;
    for (int i = 0; i < 6; i++)
    {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int a;
    double s1, st, s6, nt;
    a = v[0] + 2;
    s1 = sqrt((double)3) / 4;
    st = s1 * a * a;
    s6 = st - 3 * s1;
    nt = s6 / s1;
    (int)nt;
    cout << nt << endl;
    return 0;
}

#include <bits/stdc++.h>
#define llu unsigned long long int
#define ll long long int
#define SIZE (int)100//1e5
#define min3(a, b, c) min(a, min(b, c))
#define maximum(a, b) (a > b ? a: b)

using namespace std;

typedef pair<int, int> pi;
typedef unordered_map<int, int> um;

llu power(llu n, llu p)
{
	llu m = 1;
	while(p > 0)
	{
		m *= n;
		p--;
	}
	return m;
}

void sieve(int n, vector<bool> &prime)
{
	llu i, p;
	for(i = 2; i <= n/2; i++)
	{
		if(prime[i]){
			for(p = i * i; p <= n; p += i){
				prime[p] = false;
			}
		}
	}
}

template<typename It>
class Range
{
	It b, e;
public:
	Range(It b, It e) : b(b), e(e) {}
	It begin() const { return b; }
	It end() const { return e; }
};

template<typename ORange, typename OIt = decltype(std::begin(std::declval<ORange>())), typename It = std::reverse_iterator<OIt>>
Range<It> reverse(ORange && originalRange) {
	return Range<It>(It(std::end(originalRange)), It(std::begin(originalRange)));
}

void tile_it(int n, int m) {
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < m; ++j){
			if(i == n-1 && j == m-1)
				cout<<"W";
			else
			cout<<"B";
		}
		cout<<endl;
	}
}
bool compare(pair<ll, int> p1, pair<ll, int> p2) {
	if(p1.first == p2.first)
		return (p1.second < p2.second);
}

int left_most(int index, int i, int item, pair<ll, int> indices[]) {
	if(indices[index].first != item)
		return index;
//	cout<<indices[index].second<<"/";
	while(index > 0 && indices[index-1].first == item && indices[index-1].second > i )
		index--;
	return index;
}

ll min_cost(int n, int price[], vector<int> adj_mat[]) {
	int start, count;
	pi indices[n];
	ll cost = 0;
	for (int i = 0; i < n; ++i) {
		indices[i].first = price[i];
		indices[i].second = i;
	}
	sort(indices, indices+n);
	for(int i = 0; i < n; ++i) {
		count=0;
		start = indices[i].second;
		for(int j = 0; j < n; ++j) {
			if(adj_mat[start][j] > 0) {
				adj_mat[j][start] = 0;
				count++;
			}
		}
		cost += price[start];
	}
	return cost;
}

void sort_array(int n, int arr[]) {
	int index;
	bool flag;
	pi indices[n];
	unordered_set<int> unq;

	for (int i = 0; i < n-1; ++i) {
		for (int j = 0; j < n; ++j){
			indices[j].first = arr[j];
			indices[j].second = j;
		}
		sort(indices, indices+n);
		flag=false;
		for (int j = 0; j < n; ++j) {
			index = indices[j].second;
			if(index != j) {
				if(unq.find(index-1) == unq.end()) {
					unq.insert(index-1);
					flag=true;
					if(index == 0)
						cout<<"Error";
					else
		  				swap(arr[index-1], arr[index]);
		  			break;
		  		}
			}
			if(flag)
				break;
		}
	}
}

int log(size_t k) {
	int exponent=1;
	size_t m=k;
	while (m*k <= power(10, 16)) {
		m *= k;
		exponent++;
	}
	return exponent;
}

int make_equal(int R, int C, int d, int arr[][SIZE]) {
	ll mn=INT_MAX, curr, value;
	bool is_possible=false, flag;
	for (int i = 1; i <= power(10, 4); ++i) {
		curr=0;
		flag=true;
		for (int r = 0; r < R; ++r) {
			for (int c = 0; c < C; ++c) {
//				cout<<i<<"/"<<arr[r][c]<<"/"<<d<<endl;
				if ((i - arr[r][c])%d == 0)
					curr += abs(i - arr[r][c])/d;
				else
					flag=false;
			}
			if(flag == false)
				break;
		}
		if(flag) {
//			cout<<i<<"/";
			is_possible = true;
			if(mn > curr) {
				mn = curr;
				value=i;
			}
		}
	}
//	cout<<value<<"/";
	if (is_possible)
		return mn;
	return -1;
}

bool can_obtain_array(int n, size_t k, size_t arr[]) {
	bool flag;
	size_t m = log(k);

	while (m >= 1) {
		flag=false;
		for (int i = 0; i < n; ++i) {
			if(arr[i] >= m) {
				if(flag == true)
					return false;
				arr[i] -= m;
				flag=true;
			}
		}
		m /= k;
	}
	return true;
}

size_t count_zero_subarrays(int n, int arr[]) {
	int index=-1, realidx=-1;
	size_t count=0, curr_sum=0, m=n;
	count=(m*(m+1)/2);
	ll pref_sum[n], sum[n];
	pair<ll, int> indices[n], p;
	pref_sum[0]=arr[0];
	for (int i = 1; i < n; ++i)
	 	pref_sum[i] = pref_sum[i-1] + arr[i];
	for (int i = 0; i < n; ++i) {
		sum[i] = pref_sum[i];
		indices[i].first = pref_sum[i];
		indices[i].second = i;
	}
	sort(sum, sum + n);
	sort(indices, indices+n, compare);
	for (int i = 0; i < n; ++i) {
		if(i > 0) {
			index = upper_bound(sum, sum+n, pref_sum[i-1]) - sum - 1;
			cout<<indices[index].second;
			index = left_most(index, i, pref_sum[i-1], indices);
			realidx = indices[index].second;
			while(pref_sum[realidx-1] == pref_sum[i-1])
				realidx--;
			if(pref_sum[realidx] == pref_sum[i-1] && i <= realidx)
				count -= n-realidx;
		} else {
			index = upper_bound(sum+i, sum+n, 0) - sum  - 1;
			index = left_most(index, i, 0, indices);
			realidx = indices[index].second;
			while(pref_sum[realidx-1] == 0)
				realidx--;
			if(pref_sum[realidx] == 0)
				count -= n-realidx;
		}
	}
	return count;
}

int hash_function(pi p) {
	int x = p.first;
	int y = p.second;
	return power(x,3) + 2*y;
}

pi decrypt(int hash_value, int n, int m) {
	int count;
	pi result;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j)
			if((int)hash_function({i, j}) == hash_value) {
				result = {i, j};
				count++;
		}
	}
	if (count != 1) {
		cout<<hash_value<<"/"<<count<<endl;
		cout<<"Error/";
	}
	else
		return result;
}

size_t count_triangles(int a, int b, int c, int d, int e, int f) {
	int AB = b + (a+c)/2;
	return (e*f + a*b + (f+a)*AB);
}

bool cycle_present(int n, int m, int row, int col, string matrix[]) {
	int count=0, i, j;
	char c=matrix[row][col];
	bool visited[n][m], flag=false;
	pi start, current, parent;
	queue<pi> q;
	um mp;
	vector<pi> path;
	memset(visited, false, sizeof(visited));
	start = {row, col};
	q.push({row, col});
	visited[row][col] = true;
	while (q.size() > 0 && flag == false) {
		current = q.front();
		q.pop();
		i = current.first;
		j = current.second;
		count++;
		if (j+1 < m && matrix[i][j+1] == c) {
			if(visited[i][j+1] && i == row && j+1 == col)
				flag = true;
			else {
				visited[i][j+1] = true;
				q.push({i, j+1});
				mp[hash_function({i, j+1})] = hash_function({i, j});
			}
		}
		if (j-1 >= 0 && matrix[i][j-1] == c) {
			if(visited[i][j-1] && i == row && j-1 == col)
				flag = true;
			else {
				visited[i][j-1] = true;
				q.push({i, j-1});
				mp[hash_function({i, j-1})] = hash_function({i, j});
			}
		}
		if (i+1 < n && matrix[i+1][j] == c) {
			if(visited[i+1][j] && i+1 == row && j == col)
				flag = true;
			else {
				visited[i+1][j] = true;
				q.push({i+1, j});
				mp[hash_function({i+1, j})] = hash_function({i, j});
			}
		}
		if (i-1 >= 0 && matrix[i-1][j] == c) {
			if(visited[i-1][j] && i-1 == row && j == col)
				flag = true;
			else {
				visited[i-1][j] = true;
				q.push({i-1, j});
				mp[hash_function({i-1, j})] = hash_function({i, j});
			}
		}
	}
//	cout<<count<<"/";
	for (auto it : mp) {
		current = decrypt(it.first, n, m);
		cout<<current.first<<"/"<<current.second<<endl;
		parent = decrypt(it.second, n, m);
		cout<<parent.first<<"/"<<parent.second<<endl;
		cout<<endl;
	}
//	path.push_back(current);
//	while (current != start) {
//		current = decrypt(mp[hash_function(current)], n, m);
//		path.push_back(current);
//	}

//	for (pi coordinates : path)
//		cout<< coordinates.first<<"/"<<coordinates.second<<endl;
	if(count > 3)
		return flag;
	return false;
}

bool driver(int n, int m, string matrix[]) {
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if(cycle_present(n, m, i, j, matrix))
				return true;
		}
	}
	return false;
}

bool is_possible(int n, int arr[], int b[]){
	int diff;
	unordered_set<int> unq;
	for (int i = 0; i < n; ++i){
		diff = arr[i]-b[i];
		if (diff > 0) {
			if(unq.find(-1) == unq.end()) {
//				cout<<i;
				return false;
			}
		}
		else if (diff < 0) {
			if(unq.find(1) == unq.end()) {
//				cout<<i;
				return false;
			}
		}
		unq.insert(arr[i]);
	}
	return true;

}

struct Edge{
	int to;
	int nextID;
};

int add_edge(int k, int u, int v, Edge E[], int LE[]) {
	E[k].to = v;
	E[k].nextID = LE[u];
	LE[u] = k;
}

int main(int argc, char const *argv[])
{
	int t, x, k, y, u, v, n, m, money, val, b, days, check = 0, points;
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string str, str2;
 t=1;
//	cin>> t;
  	while(t--){
  		int n, a, d;
  		size_t k;
  		pi result;
////		cin>> n>> m;
//		int arr[n][SIZE];
		int arr1[6];
//		string matrix[n];
		for (int i = 0; i < 6; ++i)
			cin>> arr1[i];
		cout<< count_triangles(arr1[0], arr1[1], arr1[2], arr1[3],
		                       arr1[4], arr1[5]);
		// for(int i = 0; i < n; ++i)
		// 	cin>> matrix[i];
		// if ( driver(n, m, matrix))
		// 	cout<<"Yes";
		// else
		// 	cout<<"No";
		// cout<< make_equal(n, m, d, arr);
		// for(int i = 0; i < n; ++i) {
		// 	for(int j = 0; j < n; ++j)
		// 		adj_mat[i].push_back(0);
		// }
		// for(int i = 0; i < m; ++i) {
		// 	cin>> u>> v;
		// 	adj_mat[u-1][v-1] = 1;
		// }

//	cout<<min_energy(n, k, str, 'a')<<endl;
//		cout<<min_energy(n, k, str, 'b')<<endl;
		// cout<< min_cost(n, arr, adj_mat);
//
//		cin>> n;
		// tile_it(n, m);
//		int arr[n], b[n];
//		 for (int i = 0; i < n; ++i)
//		 	cin>> arr[i];
//
//		 cout<< count_zero_subarrays(n, arr);
//		int arr[n], time[n];
//		pi range[n];
//		for (int i = 0; i < n; ++i)
//			cin>> arr[i];
//		cout<<endl;
//		vector<int> adj_list[n];
//		unordered_set<int> unq;

//		cout<<endl;
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    printf("%d",(2*a+b)*b+(2*d+c)*c);
}

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

ll modulo = 1e9 + 7;

int main()
{
  string s;
  ll a,b,c,d,e,f;
  ld ar1,ar2,ar3,ar4,an1,an2,h1,h2;
  cin>>a>>b>>c>>d>>e>>f;
  ar1=a*f*pow(3,0.5)/4;
  ar2=c*d*pow(3,0.5)/4;
  h1=pow(a*a+f*f+a*f,0.5);
  h2=pow(c*c+d*d+c*d,0.5);
  an1=asin(pow(3,0.5)*f/2/h1);
  an1=(2*M_PI/3)-an1;
  ar3=0.5*b*h1*sin(an1);

  an1=asin(pow(3,0.5)*c/2/h2);
  an1=(2*M_PI/3)-an1;
  ar4=0.5*e*h2*sin(an1);
  ar1=ar1+ar2+ar3+ar4;
  ar2=pow(3,0.5)/4;
  ar1=round(ar1/ar2);
  cout<<ar1<<endl;

	return 0;
}

#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int a[10];

int main(){
#ifdef LZT
	freopen("in","r",stdin);
#endif
	rep(i,1,6) a[i]=read();
	int nums=6,ans=0;
	while(1){
		rep(i,1,6){
			ans=ans+a[i]*2-1;
			if(a[i]>0){
				a[i]--;
				if(a[i]==0) nums--;
			}
		}
		if(nums<3) break;
		else if(nums==3){
			int x=0;
			rep(i,1,6) if(a[i]>0) x=a[i];
			ans=ans+x*x;
			break;
		}
		else if(nums==4){
			int x=0,y=0;
			rep(i,1,6){
				if(a[i]>0 && a[i]!=x && a[i]!=y){
					if(x==0) x=a[i];
					else y=a[i];
				}
			}
			ans=ans+x*y*2;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;

int a, b, c, d, e, f;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> a >> b >> c >> d >> e >> f;
  int ans = 0;
  int cur = a;
  int c1 = 1, c2 = 1;
  for (int i = 1; i <= e + f; i++) {
    if (i > f && c1 >= 0) {
      c1--;
    }

    if (i > b && c2 >= 0) {
      c2--;
    }
    cur += c1 + c2;
    ans += cur;
  }
  cout << ans << "\n";
}

#include <bits/stdc++.h>
#define fr(i,a,n) for( i=a;i<=n;i++)
#define rf(i,n,a) for( i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pp(a,b) pb(mp(a,b))
#define fi first
#define se second
#define ll long long
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a))
#define cl(a) mem(a,0)
#define all(x) x.begin(),x.end()
#define wi(x) cerr << #x << " is " << x << endl;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e5+ 3;
int buy[N], sell[N];
void each_case(){
    int a[6], i, j;
    fr(i, 0, 5) cin >> a[i];
    int tot = 0, z;
    while(true){
        z = 0;
        fr(i, 0, 5){
            tot += 2*a[i] - 1;
            a[i]--;
            if(!a[i])z++;
        }
        if(z) break;
    }

    fr(i, 0, 5)
        if(a[i]){
            tot += a[i]*a[i];
            cout << tot << endl;
            return;
        }

    cout << tot << endl;
}

int main() {
	fastio
    int t = 1;
    // cin >> t;
    while(t--)each_case();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

bool ok(string a, string b)
{
    if (a == b) return 1;
    if (a != b && a.size()%2 ) return 0;
    int n = a.size();
    string x1, x2, y1, y2;
    x1 = a.substr(0, n/2);
    x2 = a.substr(n/2, n/2);
    y1 = b.substr(0, n/2);
    y2 = b.substr(n/2, n/2);
    return ok(x1, y1) && ok(x2, y2) || ok(x1, y2) && ok(x2, y1);
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    string  a, b;
    cin >> a >> b;
    if (ok(a, b)) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int area(int A[6]){
	int z = 0;
	for(int i=0;i<6;i++){
		if(A[i] != 0){
			z++;
		}
	}
	if(z != 6){
		switch(z){
			case 3:
				return 1;
			case 4:
				return 3;
			default:
				return 0;
		}
	}
	int ret = 0;
	int B[6];
	for(int i=0;i<6;i++){
		ret += 2*A[i]-1;
		B[i] = A[i]-1;
	}
	ret += area(B);
	return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int A[6];
	for(int i=0;i<6;i++){
		cin >> A[i];
	}
	cout << area(A) << '\n';

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int a[10];
    for(int i = 1; i <= 6; ++i) scanf("%d", &a[i]);
    int ans = 0;
    int x = a[1] * 2 + 1;
    for(int i = 1; i <= min(a[2], a[6]); ++i)
    {
        ans += x;
        x += 2;
    }
    int i = min(a[2], a[6]) + 1;
    for(; i <= max(a[2], a[6]); ++i) ans += x;
    x = a[4] * 2 + 1;
    for(i = 1; i <= min(a[3], a[5]); ++i)
    {
        ans += x;
        x += 2;
    }
    printf("%d", ans);
    return 0;
}

/*
***************************************************************************************************************

                            Author : Yash Sadhwani

                        PATIENCE IS ABOVE PERFECTION !!!!

**************************************************************************************************************
*/
#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sd(x) scanf("%lf",&x)
#define sc(x) scanf("%c",&x)
#define ss(x) scanf("%s",x)
#define vl vector<ll>
#define vi vector<int>
#define vvl vector< vl >
#define vvi vector< vi >
#define pb push_back
#define mod 1000000007
#define mem(x,y) memset(x,y,sizeof(x))
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define max_int_value 2147483647
#define max_long_value 9223372036854775807
#define ub(X,v) upper_bound(X.begin(),X.end(),v)
#define lb(X,v) lower_bound(X.begin(),X.end(),v)

//qsort(ww,cc,sizeof(tp),compare);
/*int compare(const void *a,const void *b){
    ll y=((((tp*)a)->w)-(((tp*)b)->w));
    if(y>0)return 1;
    else if(y==0)return 0;
    else return -1;
}

//return true if in correct positions
bool way(ii x,ii y){
    return x.first<y.first or x.first==y.first and x.second<y.second;
}

//return false if in correct positions
struct OrderBy
{
    bool operator() (ii a, ii b) { return a.S < b.S; }
};
priority_queue<ii, std::vector<ii >, OrderBy> Q;

ll modpow(ll base, ll exponent,ll modulus){
    if(base==0&&exponent==0)return 0;
    ll result = 1;
    while (exponent > 0){
        if (exponent % 2 == 1)
            result = (result * base) % modulus;
        exponent = exponent >> 1;
        base = (base * base) % modulus;
    }
    return result;
}

#define getchar_unlocked getchar
using namespace std;
inline int scan(){
    char c = getchar_unlocked();
    int x = 0;
    while(c<'0'||c>'9'){
        c=getchar_unlocked();
    }
    while(c>='0'&&c<='9'){
        x=(x<<1)+(x<<3)+c-'0';
        c=getchar_unlocked();
    }
    return x;
}

*/

#define MAXN 100010
#define ls (node<<1)
#define rs ((node<<1)+1)
#define ii pair<int,int>
#define F first
#define S second

const double PI = acos(-1.0);
const double eps = 1e-5;

double gcd(double x,double y){
    while(fabs(x) > eps and fabs(y) > eps){
        if(x > y) x -= floor(x/y)*y;
        else y -= floor(y/x)*x;
    }
    return x+y;
}

double a_cos(double a, double b, double c){
    return acos((a*a + b*b -c*c)/(2*a*b));
}

double semip(double a,double b,double c){
    return (a+b+c)/2.0;
}

double area_t(double a, double b, double c){
    double P = semip(a,b,c);
    double S = sqrt(P*(P-a)*(P-b)*(P-c));
    return S;
}

double circumradius(double a, double b, double c){
    double S = area_t(a,b,c);
    double R = (a*b*c)/(4*S);
    return R;
}

double dist(double x1,double y1,double x2,double y2){
    double D = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
    return D;
}

double area_regular_polygon(double R, double N){
    double A = (R*R*0.5*N*sin(2*PI/N));
    return A;
}

int N;

ll closest(double x){
    ll a = ceil(x);
    if(a - 1e-5 < x)return a;
    else return floor(a);
}

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

double tell(ll a,ll b){
    ll ret = a * a + b * b + (a * b);
    return sqrt(ret);
}

inline void ReadInput(void){
    sl(a1); sl(a2); sl(a3); sl(a4); sl(a5); sl(a6);
}

double p, q, r;

inline void solve(void){
    p = tell(a1, a6);
    r = tell(a4, a5);
    q = tell(a2, a3);
    double area = area_t(a2,a3,q) + area_t(a1,a6,p) + area_t(p, q, r) + area_t(a4, a5, r);
    double area1 = area_t(1,1,1);
    //cout << area1 << endl;
    double ans = (area / area1);
    ans = ans + 0.3;
    ans = floor(ans);
    cout << ans;
}

inline void Refresh(void){

}

int main()
{
    //ios_base::sync_with_stdio(false);
    ReadInput();
    solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

int main() {
	LL a[6];
	for(int i = 0; i < 6; i++) {
		cin >> a[i];
	}

	LL ans = (a[0] + a[1] + a[3])*(a[0] + a[1] + a[3]) - a[0]*a[0] - a[2]*a[2] - a[4]*a[4];
	cout << ans << endl;

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

ll calc(int a, int b, int c, int d, int e, int f){
    if(a == 0 || b == 0 | c == 0 || d == 0 || e == 0 || f == 0){
        if(a == c && a == e && a == 1){
            return 1;
        }
        if(b == d && b == f && b == 1){
            return 1;
        }
        return 0;
    }
    //if(a + b + c + d + e + f == a + d) return 0;
    //if(a + b + c + d + e + f == b + e) return 0;
    //if(a + b + c + d + e + f == c + f) return 0;
    ll res = 2 * (a + b + c + d + e + f) - 6;
    return res + calc(a - 1, b - 1, c - 1, d - 1, e - 1, f - 1);
}

int main(void){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    cout << calc(a, b, c, d, e, f) << endl;

	return 0;
}

#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld double
#define vi vector < int >
#define cd complex<double>
#define vpii vector < pii >
#define sz(x) int((x).size())
#define pii pair < int, int >
//#define piii pair < pii, int >
#define fenwick(x) ((x) & -(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << "[" << #x << "]: " << x << "\n";

using namespace std;

//CZY DANE POSORTOWANE, N = 0, N = 1, CZYTANIE TRESCI, < rosnaco, > malejaco

ld tab[6];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	for (int i = 0; i < 6; ++i)cin >> tab[i];

	cout << (tab[0] + tab[1] + tab[2])*(tab[0] + tab[1] + tab[2]) - (tab[0] + tab[2] + tab[4])*(tab[0] + tab[2] + tab[4]);

	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	ll v1, v2;
	cin >> v1 >> v2;
	ll k = max(v1, v2);
	ll m = min(v1, v2);

	for(ll i = 0; i < 4; i++) {
		ll v;
		cin >> v;
	}

	ll res = 0;
	for(ll i = 0; i < m; i++) {
		res += (k + i) + (k + i +1);
	}

	for(ll i = m; (k + i) >= (m+1); i--) {
		res += (k + i) + (k + i - 1);
	}

	cout << res << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 15;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
int a[N];
map<int ,int > m;
map<int ,int > :: iterator it;
int main()
{
     for(int i=0;i<6;i++)
     {
         cin>>a[i];
         m[a[i]] ++ ;
     }
     sort(a,a+6);
     int l1=0,l2 = 0;
     for(it = m.begin();it!=m.end();it++)
     {
         int x = it->second;
         if(x%2==1 && !l1) l1 = it->first;
         if(x%2==1 && l1) l2 = it->first;
     }
     //cout<<l1<<"  "<<l2<<endl;
     int ans = 0;
     if(l1==0 && l2==0)
     {
         for(int i=a[0];i<=a[5];i++)
         {
             ans += 2*i+1;
         }
         ans *=2;
     }
     else
     {
         for(int i=l1;i<=a[5];i++)
         {
             ans += 2*i+1;
         }
         for(int i = l2;i<=a[5];i++)
         {
             ans += 2*i+1;
         }

     }
     cout<<ans<<endl;
     return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

int main(){

  ios_base :: sync_with_stdio(false);
  cin.tie(NULL);

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

  cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;

  long long n1 = 3 + (a1-1)*2;
  long long an = (a2-2)*2 + n1 + 2;
  long long sn = ((n1 + 2 + an)*(a2-1))/2;

  cout << n1 + an + sn << endl;

  return 0;
}

#include<iostream>
using namespace std;
int main(){
int a1,a2,a3,a4,a5,a6;
while (scanf("%d %d %d %d %d %d", &a1,&a2,&a3,&a4,&a5,&a6)!=EOF){
int rt = 0;
int i, j = a2*2;
for (i = 0; i < a3+a4; i++) {
rt += j;
if (i < a1 && i < a3)j++;
else if (i >= a1 && i >= a3)j--;
}
printf("%d\n", rt);
}
return 0;
}
//2 4 5 3 3 6

//techwiz911
#include<bits/stdc++.h>
#define pb push_back
#define SZ(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define gcd __gcd
#define b_c __builtin_popcount
#define mp make_pair
#define fi(i,a,b) for(int i=a;i<b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define tr(c,it) for(typeof(c).begin() it=(c).begin();it!=(c).end();it++)
#define X first
#define Y second
#define init(a,b) memset(a,b,sizeof(a))
#define n_p next_permutation
#define b_s binary_search
#define endl '\n'
#define INF INT_MAX
#define INFL LLONG_MAX
#define sd(n) scanf("%d",&n)
#define pd(n) printf("%d\n",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define ss(n) scanf("%s",n)
#define ps(n) printf("%s",n);
#define sp() printf(" ");
#define ln() printf("\n");
#define TC() int t;sd(t);while(t--)
#define trace1(x)                cerr <<#x<<": "<<x<<endl;
#define trace2(x, y)             cerr <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cerr <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define die(s)  cout<<s<<endl; exit(0);

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef set<int> SI;
typedef set<LL> SLL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;

void FastIO()
{ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);}
LL modpow(LL a, LL p, LL mod)
{LL ret=1;while(p){if(p&1)ret=(ret*a)%mod;a=(a*a)%mod;p/=2;}return ret;}
LL power(LL a, LL p)
{LL ret=1;while(p){if(p&1)ret=(ret*a);a=(a*a);p/=2;}return ret;}
//Template Ends Here

int a[10];
int main()
{
    FastIO();

    fi(i,0,6)
        cin>>a[i];
    sort(a,a+6);
    LL ans=0;
    fi(i,0,a[3])
        ans+=(2*a[0]-1+2*(i+1));
    fi(i,0,a[0])
        ans+=(2*a[3]-1+2*(i+1));
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
using namespace std;

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

    int triCnt=0;

    int edgCnt=0;

    int minEdg1=a2<a6?a2:a6;
    for(edgCnt=0;edgCnt<minEdg1;edgCnt++)
        triCnt+=(2*(a1+edgCnt)+1);

    int minEdg2=a3<a5?a3:a5;
    for(edgCnt=0;edgCnt<minEdg2;edgCnt++)
        triCnt+=(2*(a4+edgCnt)+1);

    int dEdg=a2+a3-minEdg1-minEdg2;
    triCnt+=((2*(a1+a2))*dEdg);

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

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x1, x2, x3, x4, x5, x6;
    cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6;
    cout << pow(x1 + x2 + x3, 2) - x1*x1 - x3*x3 - x5*x5;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a[6];
	for(int x=0;x<5;x++)
		cin>>a[x];
	int s=0;
	for(int x=0;x<6;x++)
		s+=a[x]*2-1;
	cout<<s<<"\n";
	return 0;
}

#include <bits/stdc++.h>
//#define cerr if(false)cerr
//     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
//       ▄██████████████▄
//     ▄█   AC    ████████
//    ▄█▄▄    ▄▄▄▄  ██████
//   █  ██████  ██████████
// ▄▄██████▄  ████  ██████
//█▄▄▄▄▄▄▄▄█        █████
//     █             █████
//   ▄██           ▄██████
// ▄████         ▄████████
//██████        ██████████
// ███ █         ███ █████
//     █             █████
//     █             █████
//     █             █████
//     █▄▄▄▄▄▄▄▄▄▄▄▄▄███
//        ███      ███
//      █████    █████
#define i64 long long

#define debug(x) { cerr << #x << " = "; cerr << (x) << endl; }
#define debugA(a,f,s) { cerr << #a << " = "; for(int i=f;i<s;i++) cerr << a[i] << ' '; cerr << endl; }
using namespace std;
vector<double> f;
void input()
{
    f.resize(6);
    for(auto&z:f)cin>>z;
}
double area(double a,double b,double anpha)
{
    return a*b*double(1)/double(2)*sin(anpha);
}
bool check(double x)
{
    double EPS=0.00000000001;
    return fabs(x-(int)x)<EPS;
}
void solve()
{
    double s1=area(f[0]+f[1],f[0]+f[5],2*acos(0)*double(1)/double(3))-area(f[0],f[0],2*acos(0)*double(1)/double(3));
    double s2=area(f[3]+f[2],f[3]+f[4],2*acos(0)*double(1)/double(3))-area(f[3],f[3],2*acos(0)*double(1)/double(3));
    double sbase=area(1.0,1.0,2*acos(0)*double(1)/double(3));
    cerr<<sbase<<endl;
    s1+=s2;
    if(check(s1/sbase))cout<<(int)(s1/sbase);
    else cout<<(int)(s1/sbase)+1;
    cerr<<s1/sbase<<endl;

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    input();
    solve();
//    freopen("","r",stdin);
//    freopen("","w",stdout);
}
/*

Code written by a random fan of Tokyo_Square
gb_DH_VNU

 */

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int a[10];

long long calc(int x, int y) {
    long long ret = 0;
    for (int i = 1; i <= y; i ++) {
        ret += 2ll * x + 1;
        x ++;
    }
    return ret;
}
long long work() {
    long long ret = 0;
    ret = calc(a[0], min(a[1], a[5])) + calc(a[3], min(a[2], a[4]));
    ret += 1ll * (a[3] + a[2]) * abs(a[1] - a[5]);
    return ret;
}
int main() {
    for (int i = 0; i < 6; i ++) {
        scanf("%d", &a[i]);
    }
    printf("%I64d\n", work());
    return 0;
}

#include<cstdio>
#include<algorithm>
#include<map>
#include<cstring>
#include<vector>
#include<cmath>
#include<iostream>
#include<string>
#define N 100010
#define M 1010
#define P 1000000007
using namespace std;
int a,b,c,d,e,f,ans,i;
int main()
{
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    for (i=0;i<a;i++)
    {
        ans=ans+2*b+1;
        if (i<c) b++;
    }
    for (i=0;i<f;i++)
    {
        ans=ans+2*e+1;
        if (i<d) e++;
    }
    printf("%d",ans);
}

#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
const __int64 maxn = 2147483647;
__int64 max(__int64 a,__int64 b)
{
	return a<b?b:a;
}
__int64 sum=0;
__int64 rep(__int64 x,__int64 y)
{
	if (x==1&&y==1) return 6+sum;
	if ((x==0&&y!=0) ||( x!=0&&y==0)) return sum+1;
	sum+=(x+x-1)*3+(y+y-1)*3;
	rep(x-1,y-1);

}
int main()
{
	__int64 n,m,a1,a2,b1,b2;
	scanf("%I64d%I64d",&n,&m);
	scanf("%I64d%I64d",&a1,&a2);
	scanf("%I64d%I64d",&b1,&b2);
	printf("%I64d\n",rep(n,m));

				return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    int now = a*2-1,res=0;
    for(int i=1;i<=b+c;i++){
        now += 2;
        if(i>b)now--;
        if(i>f)now--;
        res += now;
    }
    printf("%d",res);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)
#define X real()
#define Y imag()

typedef long long lli;
typedef complex<lli> P;
const int MX = 100005 , infi =1000000000 , mod = 1000000007;
typedef pair<int,int> pii;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int a[6];
    for(int i=0;i<6;i++)cin>>a[i];
    cout<<pow(a[0]+a[1]+a[2],2)-pow(a[0],2)-pow(a[2],2)-pow(a[4],2);
    return 0;
}

#include <iostream>
using namespace std;

int main () {
    int a1, a2, a3, a4, a5, a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    int c, d;
    c = a1; d = a2;
    long long finalAns = 0;
    for (int i = 0; i < d; i++) {
        finalAns += (c * 2 + 1);
        c++;
    }
    for (int i = 0; i < a1; i++) {
        c--;
        finalAns += (c * 2 + 1);
    }
    cout << finalAns << "\n";
}

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;

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

int main()
{
    while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)
    {
        int p=min(b,f),q=min(c,e),t=max(b,f)-min(b,f),tt=min(max(b,f),max(c,e));
        cout<<p*(2*a+p)+q*(2*d+q)+t*(2*tt+t)<<endl;
    }
    return 0;
}
/*
2 4 5 3 3 6
63
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <functional>
using namespace std;
const int maxn = 10001;
int x[6], ans;
int main()
{
	for(int i = 0; i < 6; ++i)
		scanf("%d", x + i);
	for(int i = 0; i < 6; ++i)
		if(x[(i + 0) % 6] == x[(i + 2) % 6] && x[(i + 3) % 6] == x[(i + 5) % 6])
		{
			int a = x[(i + 1) % 6], b = x[(i + 0) % 6] + x[(i + 1) % 6], c = x[(i + 0) % 6];
			int d = x[(i + 4) % 6], e = x[(i + 3) % 6] + x[(i + 4) % 6], f = x[(i + 3) % 6];
			if(b != e)
				continue;
			ans = (a + b) * c + (d + e) * f;
			break;
		}
	printf("%d\n", ans);
	return 0;
}