Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to $120^{\circ}$. 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.


-----Input-----

The first and the single line of the input contains 6 space-separated integers a_1, a_2, a_3, a_4, a_5 and a_6 (1 ≤ a_{i} ≤ 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.


-----Output-----

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


-----Examples-----
Input
1 1 1 1 1 1

Output
6

Input
1 2 1 2 1 2

Output
13



-----Note-----

This is what Gerald's hexagon looks like in the first sample:

$\theta$

And that's what it looks like in the second sample:

$A$

Difficulty: MEDIUM_HARD

Solutions:
from sys import stdin, stdout
input = stdin.readline
t = 1
for _ in range(t):
	a = [int(x) for x in input().split()]
	k = a[0] + a[1] + a[2]
	ans = k * k - (a[0] * a[0] + a[2] * a[2] + a[4] * a[4])
	print(ans)


(a, b, c, d, e, f) = [int(i) for i in input().split()]
print((a + b + c) ** 2 - a ** 2 - c ** 2 - e ** 2)


import math
l = input().split()
for i in range(6):
	l[i] = int(l[i])
s = 3 ** 0.5 / 4
b = (l[0] ** 2 + l[1] ** 2 + l[0] * l[1]) ** 0.5
c = (l[2] ** 2 + l[3] ** 2 + l[2] * l[3]) ** 0.5
d = (l[4] ** 2 + l[5] ** 2 + l[4] * l[5]) ** 0.5

def ar(b, c, d):
	s = b + c + d
	s /= 2
	return (s * (s - b) * (s - c) * (s - d)) ** 0.5
A = (ar(l[0], l[1], b) + ar(l[2], l[3], c) + ar(l[4], l[5], d) + ar(c, d, b)) / s
if int(A) == int(A + 0.5):
	print(int(A))
else:
	print(int(A + 0.5))


a = list(map(int, input().split()))
n = a[0] + a[1] + a[2]
an = 1 + (n - 1) * 2
sn = n * (1 + an) / 2
l = []
for i in [0, 2, 4]:
	c = 1 + (a[i] - 1) * 2
	m = a[i] * (1 + c) / 2
	l.append(m)
print(int(sn - sum(l)))


line = list(map(int, input().split()))
print(sum(line[0:3]) ** 2 - line[0] ** 2 - line[2] ** 2 - line[4] ** 2)


import math

def getarea(a):
	return a * a * math.sqrt(3) / 8
x = input('').split(' ')
x = [int(y) for y in x]
a1 = x[0]
a2 = x[1]
a3 = x[2]
a4 = x[3]
a5 = x[4]
a6 = x[5]
totarea = (a6 / 2 + a2 / 2 + a1) * (a2 * math.sqrt(3) / 2 + a3 * math.sqrt(3) / 2)
totarea -= getarea(a2) + getarea(a3) + getarea(a5) + getarea(a6)
print(int(4 * totarea / math.sqrt(3) + 0.5))


from math import *
a = [int(i) for i in input().split()]
res = pow(a[0] + a[1] + a[2], 2) - pow(a[0], 2) - pow(a[2], 2) - pow(a[4], 2)
print('%.0f' % res)


(a, b, c, d, e, f) = map(int, input().split())
x = (a << 1) - 1
s = 0
for i in range(b + c):
	if i < b:
		x += 1
	elif i > b:
		x -= 1
	if i < f:
		x += 1
	elif i > f:
		x -= 1
	s += x
print(s)


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
print((a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from queue import Queue
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
INF = float('inf')
mod = 10 ** 9 + 7

def area(side):
	return side * side
(a1, a2, a3, a4, a5, a6) = MAP()
big = area(a1 + a2 + a3)
smalls = area(a1) + area(a3) + area(a5)
print(big - smalls)


from math import sqrt
(a, b, c, d, e, f) = map(int, input().split())
ans = (a + b + c) ** 2 - a ** 2 - c ** 2 - e ** 2
print(ans)


a = list(map(int, input().split()))
print(sum(a[:3]) ** 2 - (a[0] ** 2 + a[2] ** 2 + a[4] ** 2))


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
now = a1 * 2 + 1
res = now
for i in range(1, a2 + a3):
	if i == a2:
		now += 1
	if i == a6:
		now += 1
	if a2 < a6:
		if i < a2:
			now += 2
		if i >= a6:
			now -= 2
	else:
		if i < a6:
			now += 2
		if i >= a2:
			now -= 2
	res += now
print(res)


import math
nums = list(map(int, input().split()))
a1 = nums[0]
a2 = nums[1]
a3 = nums[2]
a5 = nums[4]
eq = (a1 + a2 + a3) ** 2
ans = eq - (a1 ** 2 + a3 ** 2 + a5 ** 2)
print(ans)


a = list(map(int, input().split()))
print((a[5] + a[4]) * (a[0] + a[1]) * 2 - a[4] ** 2 - a[1] ** 2)


(a, b, c, d, e, f) = map(int, input().split())
print((b + c + d) ** 2 - b ** 2 - d ** 2 - f ** 2)


import sys

def sideHeight(k):
	return k

def solve(hexagon):
	top = hexagon[0]
	base = hexagon[3]
	(lside1, rside1) = (hexagon[5], hexagon[1])
	(lside2, rside2) = (hexagon[4], hexagon[2])
	tier1Base = top + sideHeight(min(lside1, rside1))
	tier1Triangles = 0
	for i in range(top, tier1Base):
		tier1Triangles += 2 * i + 1
	tier2Length = max(lside1, rside1) - min(lside1, rside1)
	tier2Triangles = 0
	for i in range(tier2Length):
		tier2Triangles += tier1Base * 2
	tier3Triangles = 0
	for i in range(base, tier1Base):
		tier3Triangles += 2 * i + 1
	return tier1Triangles + tier2Triangles + tier3Triangles

def readinput():
	hexagon = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	print(solve(hexagon))
readinput()


l = list(map(int, input().split()))
c = l[0] + l[1] + l[2]
print(c * c - l[0] ** 2 - l[2] ** 2 - l[4] ** 2)


s = list(map(int, input().split()))
print((s[0] + s[1] + s[2]) ** 2 - s[0] ** 2 - s[2] ** 2 - s[4] ** 2)


(a, b, c, d, e, f) = map(int, input().split())
aa = (a ** 2 + b ** 2 + a * b) ** 0.5
bb = (c ** 2 + d ** 2 + c * d) ** 0.5
cc = (e ** 2 + f ** 2 + e * f) ** 0.5
p = (aa + bb + cc) / 2
print(round(a * b + c * d + f * e + (p * (p - aa) * (p - bb) * (p - cc)) ** 0.5 / (3 ** 0.5 / 4)))


import math as mt
import sys, string
input = sys.stdin.readline
from heapq import heappush, heapify, heappop
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def lcm(a, b):
	return a * b // mt.gcd(a, b)
l = L()
print((l[-1] + l[0] + l[1]) ** 2 - l[1] ** 2 - l[-1] ** 2 - l[-3] ** 2)


import math
(a1, a2, a3, a4, a5, a6) = map(int, input().split())
l = a1 + a2 + a3
print(l * l - a1 * a1 - a5 * a5 - a3 * a3)


(a_1, a_2, a_3, a_4, a_5, a_6) = map(int, input().split())
print((a_1 + a_2 + a_3) ** 2 - a_1 ** 2 - a_3 ** 2 - a_5 ** 2)


a = list(map(int, input().strip().split(' ')))
print((a[0] + a[1] + a[2]) ** 2 - a[0] ** 2 - a[2] ** 2 - a[4] ** 2)


def main():
	a = [int(i) for i in input().split()]
	result = 0
	while a.count(1) < 4:
		for i in range(6):
			m = i
			l = i - 1 if i != 0 else 5
			r = i + 1 if i != 5 else 0
			if a[l] > 1 and a[r] > 1:
				result += 2 * a[m] + 1
				a[m] += 1
				a[l] -= 1
				a[r] -= 1
	result += 4 * max(a) + 2
	print(result)
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	a = LI()
	b = a[1]
	c = a[-1]
	k = a[1] + a[2]
	r = 0
	t = a[0] * 2 - 1
	for i in range(k):
		if b > 0:
			t += 1
		elif b < 0:
			t -= 1
		if c > 0:
			t += 1
		elif c < 0:
			t -= 1
		r += t
		b -= 1
		c -= 1
	return r
print(main())


l_s = list(map(int, input().split()))
w = l_s[0] / 2
print((l_s[0] + l_s[1] + l_s[2]) ** 2 - l_s[0] ** 2 - l_s[2] ** 2 - l_s[4] ** 2)


import math

def solve():
	(a1, a2, a3, a4, a5, a6) = map(int, input().split())
	n = a1 + a2 + a3
	print(n ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)
t = 1
for _ in range(t):
	solve()


(start, rsplit, rend, end, lend, lsplit) = (int(i) for i in input().split())
start = 2 * start + 1
end = 2 * end + 1
onsplit = start + min(lsplit, rsplit) * 2 - 2
triA = sum(range(start, onsplit + 2, 2))
triB = (onsplit + 1) * abs(rsplit - lsplit)
triC = sum(range(onsplit, end - 2, -2))
print(triA + triB + triC)


sides = list(map(int, input().split()))
up = sides[1]
(x, y, total) = (sides[0], sides[2], sides[2] + sides[3])
ans = 0
for _ in range(total):
	down = up + ((x > 0) & (y > 0)) - ((x <= 0) & (y <= 0))
	ans += down + up
	up = down
	x -= 1
	y -= 1
print(ans)


import math
(a, b, c, d, e, f) = map(int, input().split(' '))
x = b + a + c
y = d + c + e
z = f + e + a
s = x * x - a * a - c * c - e * e
print(int(s))


from math import radians, cos, sin, atan2, sqrt, floor, acos

def rotate(point, alpha):
	x = point[0]
	y = point[1]
	return (x * cos(alpha) - y * sin(alpha), x * sin(alpha) + y * cos(alpha))

def crs(a, b):
	return a[0] * b[1] - a[1] * b[0]

def m(end, start):
	return (end[0] - start[0], end[1] - start[1])

def area(poly):
	ret = 0
	n = len(poly)
	for i in range(n):
		j = (i + 1) % n
		ret += crs(poly[i], poly[j])
	return abs(ret) / 2.0

def dist(a, b):
	return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)

def get_next_point(p0, p1, x, y):
	r = ((p1[0] - p0[0]) / x * y, (p1[1] - p0[1]) / x * y)
	r = rotate(r, radians(60))
	return (p1[0] + r[0], p1[1] + r[1])
a = list(map(int, input().split()))
pnt = [(0, 0), (a[0], 0)]
for i in range(1, len(a)):
	pnt.append(get_next_point(pnt[-2], pnt[-1], a[i - 1], a[i]))
	assert dist(pnt[-2], pnt[-1]) - a[i] <= 1e-07
ret = area(pnt) * 4 / sqrt(3)
for i in range(floor(ret), floor(ret) + 3):
	if abs(ret - i) < 1e-07:
		ret = i
print(ret)


l = list(map(int, input().split()))
sub = l[0] ** 2 + l[2] ** 2 + l[4] ** 2
print((l[0] + l[1] + l[2]) ** 2 - sub)


def f(x):
	ans = 0
	for i in range(1, x + 1):
		ans += 2 * i - 1
	return ans
a = list(map(int, input().split()))
print((a[0] + a[1]) * 2 * (a[1] + a[2]) - f(a[1]) - f(a[4]))


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
ans = (a1 + a2 + a3) * (a1 + a2 + a3)
ans -= a1 * a1
ans -= a3 * a3
ans -= a5 * a5
print(ans)


def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def printlist(l):
	print(' '.join([str(x) for x in l]))
a = lt()
sum = a[3] + a[4] + a[5]
print(sum * sum - a[1] ** 2 - a[3] ** 2 - a[5] ** 2)


def nbTriangle(cote):
	total = 0
	for i in range(1, cote + 1, 1):
		total += 2 * i - 1
	return total
lenght = input().split(' ')
for i in range(6):
	lenght[i] = int(lenght[i])
coteGrandTriangle = lenght[0] + lenght[1] + lenght[2]
totalTriangle = nbTriangle(coteGrandTriangle)
ans = totalTriangle - nbTriangle(lenght[0]) - nbTriangle(lenght[2]) - nbTriangle(lenght[4])
print(ans)


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(a1, a2, a3, a4, a5, a6) = Neo()
print((a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)


A = [int(x) for x in input().split()]
print((A[0] + A[1] + A[2]) ** 2 - A[0] ** 2 - A[2] ** 2 - A[4] ** 2)


import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
(a1, a2, a3, a4, a5, a6) = map(int, input().split())
x1 = math.sqrt(a1 ** 2 + a6 ** 2 + a1 * a6)
x2 = math.sqrt(a2 ** 2 + a3 ** 2 + a2 * a3)
x3 = math.sqrt(a4 ** 2 + a5 ** 2 + a4 * a5)
p = (x1 + x2 + x3) / 2
x = p - x1
y = p - x2
z = p - x3
ans = math.sqrt(x * y * z * p) + math.sqrt(3) / 4 * (a1 * a6 + a2 * a3 + a4 * a5)
ans /= math.sqrt(3) / 4
print(round(ans))


def input_ints():
	return list(map(int, input().split()))

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	a = input_ints()
	ans = 0
	x = a[0]
	for i in range(a[1] + a[2]):
		d = 0
		d += 1 if i < a[1] else -1
		d += 1 if i < a[5] else -1
		d //= 2
		ans += 2 * x + d
		x += d
	print(ans)
main()


import math
arr = [float(i) for i in input().split()]
arr1 = [[0] * 2 for i in range(6)]
(arr1[1][0], arr1[1][1]) = (-arr[0], 0)
(arr1[2][0], arr1[2][1]) = (arr1[1][0] - arr[1] / 2, arr1[1][1] + arr[1] * math.sqrt(3) / 2)
(arr1[3][0], arr1[3][1]) = (arr1[2][0] + arr[2] / 2, arr1[2][1] + arr[2] * math.sqrt(3) / 2)
(arr1[4][0], arr1[4][1]) = (arr1[3][0] + arr[3], arr1[3][1])
(arr1[5][0], arr1[5][1]) = (arr1[4][0] + arr[4] / 2, arr1[4][1] - arr[4] * math.sqrt(3) / 2)
sq = 0.0
for i in range(5):
	sq += (arr1[i + 1][0] - arr1[i][0]) * (arr1[i][1] + arr1[i + 1][1]) / 2
sq += (arr1[0][0] - arr1[5][0]) * (arr1[0][1] + arr1[5][1]) / 2
print(round(sq / (math.sqrt(3) / 4)))


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
ans = 0
cur = a1 * 2 + 1
for i in range(min(a2, a6)):
	ans += cur
	cur += 2
cur -= 1
for i in range(min(a2, a6), max(a2, a6)):
	ans += cur
cur -= 1
for i in range(min(a3, a5)):
	ans += cur
	cur -= 2
print(ans)


ar = list(map(int, input().split()))
print((ar[0] + ar[1] + ar[2]) ** 2 - ar[0] ** 2 - ar[2] ** 2 - ar[4] ** 2)


import sys

def sumofn(n):
	if n % 2 == 0:
		return (n + 1) * (n // 2)
	else:
		return n * (n // 2) + n

def numt(n):
	return sumofn(n) + sumofn(n - 1)

def answer(a):
	side_length = a[0] + a[1] + a[2]
	num_triangles = numt(side_length)
	num_triangles -= numt(a[0])
	num_triangles -= numt(a[2])
	num_triangles -= numt(a[4])
	return num_triangles

def main():
	a = tuple(map(int, sys.stdin.readline().split()))
	print(answer(a))
	return
main()


string = input()
sides = list(map(int, string.split()))
a = 0
for x in range(3):
	a += sides[x]
a **= 2
for x in range(0, 6, 2):
	a -= sides[x] ** 2
print(a)


(*a,) = map(int, input().split())
print((a[0] + a[1] + a[5]) ** 2 - a[1] ** 2 - a[3] ** 2 - a[5] ** 2)


def __starting_point():
	edges = [int(e) for e in input().split(' ')]
	big_triangle = sum(edges[2:5]) ** 2
	small_triangle1 = edges[0] ** 2
	small_triangle2 = edges[2] ** 2
	small_triangle3 = edges[4] ** 2
	print(big_triangle - small_triangle1 - small_triangle2 - small_triangle3)
__starting_point()


import sys
an = list(map(int, sys.stdin.readline().split()))
ans = (an[0] + an[1] + an[2]) * (an[0] + an[1] + an[2]) - an[0] * an[0] - an[2] * an[2] - an[4] * an[4]
print(ans)


import math

def sqr(x):
	return x * x

def side_(a, b):
	cos_120 = -0.5
	return abs((sqr(a) + sqr(b) - 2 * a * b * cos_120) ** 0.5)

def triangle_area(a, b, c):
	p = (a + b + c) / 2
	return abs((p * (p - a) * (p - b) * (p - c)) ** 0.5)
(a1, a2, a3, a4, a5, a6) = map(int, input().split())
sin_120 = -1 * (3 ** 0.5 / 2)
area1 = abs(a1 * a2 / 2 * sin_120)
area2 = abs(a3 * a4 / 2 * sin_120)
area3 = abs(a5 * a6 / 2 * sin_120)
side1 = side_(a1, a2)
side2 = side_(a3, a4)
side3 = side_(a5, a6)
s = triangle_area(side1, side2, side3)
all_area = area1 + area2 + area3 + s
print(round(all_area / (3 ** 0.5 / 4)))


def sp(l, d):
	return l ** 2 + l * d * 2
import time
A = [int(i) for i in input().split()]
start = time.time()
m = min(A)
while A[0] != m:
	A = A[1:] + [A[0]]
ans = sp(A[0], A[1]) + (A[2] - A[0]) * (A[0] + A[1]) * 2 + sp(A[3], A[4])
print(ans)
finish = time.time()


class CodeforcesTask559ASolution:

	def __init__(self):
		self.result = ''
		self.a = []

	def read_input(self):
		self.a = [int(x) for x in input().split(' ')]

	def process_task(self):
		dir_left_left = True
		dir_right_right = True
		last_width = self.a[2]
		height = self.a[0] + self.a[1]
		pos = 0
		triangles = 0
		going_left = self.a[1]
		going_right = self.a[3]
		while pos < height:
			width = last_width
			if dir_left_left and dir_right_right:
				width += 1
			elif not dir_left_left and (not dir_right_right):
				width -= 1
			if dir_left_left:
				going_left -= 1
				if not going_left:
					dir_left_left = False
			if dir_right_right:
				going_right -= 1
				if not going_right:
					dir_right_right = False
			triangles += last_width + width
			last_width = width
			pos += 1
		self.result = str(triangles)

	def get_result(self):
		return self.result
Solution = CodeforcesTask559ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(a1, b1, c1, a2, b2, c2) = map(int, input().split())
full = 2 * (a1 + c2) * (a1 + b1)
tr1 = a1 ** 2
tr2 = a2 ** 2
print(full - tr1 - tr2)


def sqr(a, b, c):
	return a * a + 2 * b * c

def qqq(q, w):
	return 2 * q * w
data = list(map(int, input().split()))
if data[0] == data[2]:
	print(sqr(data[0], data[1], data[2]) + sqr(data[3], data[4], data[5]))
else:
	m = min(data[0], data[2])
	s1 = sqr(m, data[1], m)
	if data[0] < data[2]:
		q = min(data[2] - m, data[5])
	else:
		q = min(data[0] - m, data[3])
	s2 = qqq(q, data[1] + m)
	mm = min(data[5], data[3])
	s3 = sqr(mm, data[4], mm)
	print(s1 + s2 + s3)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
arr = l()
out(sum(arr[:3]) ** 2 - arr[0] ** 2 - arr[2] ** 2 - arr[-2] ** 2)


sides = input()
seperate = sides.split(' ')
(a, b, c, d, e, f) = seperate
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
f = int(f)
area1 = 0
area2 = 0
area3 = 0
if b == f and c == e:
	for i in range(b):
		area1 += 2 * a + 1
		a += 1
	for i in range(e):
		area2 += 2 * d + 1
		d += 1
elif b > f:
	for i in range(f):
		area1 += 2 * a + 1
		a += 1
	b = b - f
	for i in range(b):
		area2 += 2 * a
	e = e - b
	for i in range(c):
		area3 += 2 * d + 1
		d += 1
elif b < f:
	for i in range(b):
		area1 += 2 * a + 1
		a += 1
	f = f - b
	for i in range(f):
		area2 += 2 * a
	c = c - f
	for i in range(e):
		area3 += 2 * d + 1
		d += 1
print(area1 + area3 + area2)


s = [int(i) for i in input().split()]
n = 0
k = 0
if s[1] < s[5]:
	n = (s[0] + s[0] + s[1]) * s[1]
	s[5] -= s[1]
	k = s[0] + s[1]
	n += k * s[5] * 2
	n += (s[3] + s[3] + s[4]) * s[4]
else:
	n = (s[0] + s[0] + s[5]) * s[5]
	s[1] -= s[5]
	k = s[0] + s[5]
	n += k * s[1] * 2
	n += (s[3] + s[3] + s[2]) * s[2]
print(n)


(a1, a2, a3, a4, a5, a6) = list(map(int, input().split()))
longer_side = max(a2, a6)
shorter_side = min(a2, a6)
side_diff = longer_side - shorter_side
top_base = a1 + longer_side
full_top = top_base ** 2
missing_side_triangle = side_diff ** 2
missing_top_triangle = a1 ** 2
total_top = full_top - missing_side_triangle - missing_top_triangle
bottom_base = a1 + longer_side - side_diff
full_bottom = bottom_base ** 2
missing_bottom_triangle = a4 ** 2
total_bottom = full_bottom - missing_bottom_triangle
total_triangles = total_top + total_bottom
print(total_triangles)


def read_list(t):
	return [t(x) for x in input().split()]

def read_line(t):
	return t(input())

def read_lines(t, N):
	return [t(input()) for _ in range(N)]
H = read_list(int)
print((H[0] + H[1] + H[2]) ** 2 - H[0] ** 2 - H[2] ** 2 - H[4] ** 2)


a = input().split()
b = int(a[0])
c = int(a[1])
d = int(a[2])
e = int(a[3])
f = int(a[4])
g = int(a[5])
sb = (b + c + g) ** 2
sk = c ** 2 + e ** 2 + g ** 2
jlh = sb - sk
print(jlh)


import math
import sys
inp = list(map(int, input().split()))
s1 = inp[0]
s2 = inp[1]
s3 = inp[2]
s4 = inp[3]
s5 = inp[4]
s6 = inp[5]
a = min(s6, s2)
b = s1 + a
c = max(s6, s2) - a
if a == s6:
	d = s3
else:
	d = s5
ans = 0
ans += 2 * a * s1 + a + a * a - a
ans += 2 * b * c
ans += 2 * d * s4 + d + d * d - d
print(ans)


(a1, a2, a3, a4, a5, a6) = input().split()
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
a4 = int(a4)
a5 = int(a5)
a6 = int(a6)
print(pow(a1 + a2 + a3, 2) - pow(a1, 2) - pow(a3, 2) - pow(a5, 2))


l = [int(a) for a in input().split()]
print((l[0] + l[1] + l[2]) ** 2 - (l[0] * l[0] + l[2] * l[2] + l[4] * l[4]))


import itertools
import sys
for x in itertools.permutations(map(int, input().split())):
	a = x[0] + x[1] + x[2]
	b = x[2] + x[3] + x[4]
	c = x[4] + x[5] + x[0]
	if a == b and b == c:
		print(a ** 2 - x[0] ** 2 - x[2] ** 2 - x[4] ** 2)
		sys.exit(0)


from sys import stdin
sides = list(map(int, input().split()))
side = sides[0] + sides[1] + sides[2]
big = ((2 * side - 1) // 2 + 1) ** 2
s1 = sides[0] ** 2
s2 = sides[2] ** 2
s3 = sides[4] ** 2
print(big - s1 - s2 - s3)


import sys
(a1, a2, a3, a4, a5, a6) = map(int, input().split())

def calc(h):
	res = 0
	cur = 1
	while cur <= h:
		res += cur + cur - 1
		cur += 1
	return res
ax1 = a4
ax2 = a6
ans = calc(ax1 + ax2 + a5) - calc(ax1) - calc(ax2) - calc(a2)
print(ans)


j = input().split()
k = [int(i) for i in j]
print((k[0] + k[1] + k[2]) ** 2 - k[0] ** 2 - k[2] ** 2 - k[4] ** 2)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 999999999999999999999999
alphabets = 'abcdefghijklmnopqrstuvwxyz'

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class SegTree:

	def __init__(self, n):
		self.N = 1 << n.bit_length()
		self.tree = [0] * (self.N << 1)

	def update(self, i, j, v):
		i += self.N
		j += self.N
		while i <= j:
			if i % 2 == 1:
				self.tree[i] += v
			if j % 2 == 0:
				self.tree[j] += v
			(i, j) = (i + 1 >> 1, j - 1 >> 1)

	def query(self, i):
		v = 0
		i += self.N
		while i > 0:
			v += self.tree[i]
			i >>= 1
		return v

def SieveOfEratosthenes(limit):
	isPrime = [True] * (limit + 1)
	isPrime[0] = isPrime[1] = False
	primes = []
	for i in range(2, limit + 1):
		if not isPrime[i]:
			continue
		primes += [i]
		for j in range(i * i, limit + 1, i):
			isPrime[j] = False
	return primes

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(a, b, c, d, e, f) = ria()
		ans = 0
		(r, q) = (max(f, b), min(f, b))
		p = e if f >= b else c
		ans = (2 * (a + a + 1) + (q - 1) * 2) * q // 2 + (a + a + 1 + (q - 1) * 2 + 1) * (r - q) + (a + a + 1 + (q - 1) * 2 + 1 - 1 + (d + d + 1)) * p // 2
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


l = list(map(int, input().split()))
t1 = min(l[0], l[2])
t2 = min(l[3], l[5])
s1 = 0
f1 = 2 * l[1] + 1
fl = f1 + 2 * t1
s1 = s1 + (f1 + fl - 2) * t1 // 2
f11 = 2 * l[4] + 1
f1l = f11 + 2 * t2
s1 = s1 + (f11 + f1l - 2) * t2 // 2
r = abs(l[2] - l[0])
s1 = s1 + r * 2 * (l[1] + t1)
print(s1)


ns = list(map(int, str.split(input())))
top = min(ns[1], ns[-1])
middle = max(ns[1], ns[-1]) - top
down = ns[1] + ns[2] - top - middle
triangles = (1 + ns[0] * 2 + top - 1) * top
triangles += middle * (ns[0] + top) * 2
triangles += (1 + ns[3] * 2 + down - 1) * down
print(triangles)


a = [int(i) for i in input().split()]
n = a[2] + a[3] + a[4]
print(n * n - a[0] * a[0] - a[2] * a[2] - a[4] * a[4])


from math import *
l = list(map(int, input().split()))
p = [(0, 0)]
angle = 0
for i in range(5):
	p.append((p[-1][0] + l[i] * sin(angle), p[-1][1] + l[i] * cos(angle)))
	angle += pi / 3
ans = 0
for i in range(1, 5):
	ans += 0.5 * abs(p[i][0] * p[i + 1][1] - p[i][1] * p[i + 1][0])
print(round(ans * 4 / sqrt(3)))


import math
import itertools
import os
import sys
A = map(int, input().split())
(S, ang) = (0, 0)
(x, y) = (0, 0)
for length in A:
	(px, py) = (x, y)
	x = px + length * math.cos(ang)
	y = py + length * math.sin(ang)
	S = S + x * py - y * px
	ang = ang + math.pi / 3.0
print(int(math.fabs(2 * S / math.sqrt(3)) + 0.5))


import math
a = [int(x) for x in input().split()]
b = [[0, 0]]
b.append([a[0] / 2, a[0] * math.sqrt(3) / 2])
b.append([a[0] / 2 + a[1], a[0] * math.sqrt(3) / 2])
b.append([a[0] / 2 + a[1] + a[2] / 2, (a[0] - a[2]) * math.sqrt(3) / 2])
b.append([a[0] / 2 + a[1] + a[2] / 2 - a[3] / 2, (a[0] - a[2] - a[3]) * math.sqrt(3) / 2])
b.append([a[0] / 2 + a[1] + a[2] / 2 - a[3] / 2 - a[4], (a[0] - a[2] - a[3]) * math.sqrt(3) / 2])
s = 0
for i in range(6):
	s += b[i][0] * b[(i + 1) % 6][1]
	s -= b[i][1] * b[(i + 1) % 6][0]
print(round(math.fabs(s) * 2 / math.sqrt(3)))


def get(a, b):
	return a * b
a = [int(x) for x in input().split()]
res = (a[0] + a[5] / 2 + a[1] / 2) * (a[5] + a[4]) * 2
res = res - get(a[1] / 2, a[1]) - get(a[2] / 2, a[2]) - get(a[4] / 2, a[4]) - get(a[5] / 2, a[5])
print(round(res))


def main():
	d = list(map(int, input().split()))
	res = 0
	for i in range(min(d[0], d[2])):
		res += (i + d[1] - 1) * 2 + 3
	for i in range(min(d[3], d[5])):
		res += (i + d[4] - 1) * 2 + 3
	if d[0] != d[2]:
		res += abs(d[0] - d[2]) * 2 * (min(d[0], d[2]) + d[1])
	print(res)
main()


import math
import sys
import collections
import bisect
import string
import time

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	(a, b, c, d, e, f) = get_ints()
	print((a + b + c) ** 2 - (a ** 2 + c ** 2 + e ** 2))


a = [int(i) for i in input().split()]
print((a[0] + a[4] + a[5]) ** 2 - (a[0] ** 2 + a[2] ** 2 + a[4] ** 2))


a = [int(x) for x in input().split()]
a1 = (a[0] + a[3]) * (a[1] + a[2])
a2 = a[1] * a[2]
a3 = a[4] * a[5]
print(a1 + a2 + a3)


a = [int(x) for x in input().split()]
res = 0
while True:
	if a[1] > 0 and a[5] > 0:
		res += 2 * a[0] + 1
		a[0] += 1
		a[1] -= 1
		a[5] -= 1
	elif a[5] == 0:
		res += 1
		a[0] -= 1
		a[4] -= 1
		a[5] += 1
	elif a[1] == 0:
		res += 1
		a[0] -= 1
		a[1] += 1
		a[2] -= 1
	if a[1] + a[2] == 0 and a[4] + a[5] == 0:
		break
print(res)


import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	(A0, A1, A2, A3, A4, A5) = getInts()
	base = A0
	layers = A1 + A2
	ans = 0
	assert layers == A4 + A5
	for j in range(layers):
		if A1 and A5:
			top = base + 1
			A1 -= 1
			A5 -= 1
		elif A1:
			top = base
			A1 -= 1
		elif A5:
			top = base
			A5 -= 1
		else:
			top = base - 1
		ans += top + base
		base = top
	return ans
print(solve())


ai = list(map(int, input().split()))
last = ai[0]
end = ai[3]
ai[0] = 0
ai[3] = 0
index1 = 0
index2 = 0
ans = last
while sum(ai) > 2:
	if index1 == 0:
		ai[1] -= 1
		if ai[1] == 0:
			index1 = 1
	else:
		ai[2] -= 1
		last -= 1
	if index2 == 0:
		ai[5] -= 1
		last += 1
		if ai[5] == 0:
			index2 = 1
	else:
		ai[4] -= 1
	ans += last * 2
ans += end
print(ans)


(a1, a2, a3, _, a5, _) = list(map(int, input().split()))
print((a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)


As = list(map(int, input().split()))

def solve(As):
	L = As[0] + As[1] + As[2]
	return L ** 2 - As[0] ** 2 - As[2] ** 2 - As[4] ** 2
print(max(solve(As), solve(As[1:] + [As[0]])))


from math import sqrt
a = [0] + [int(i) for i in input().split()]
S = sqrt(3) * (a[6] * a[5] + a[1] * a[2] + a[3] * a[4]) / 2 + (a[1] - a[4]) * (a[1] - a[4]) * sqrt(3) / 4
print(int(S * 4 / sqrt(3) + 0.5))


a = list(map(int, input().split()))
u = [False] * 6
u[0] = True
l = a[0]
s = 0
tr = 0
while not u[3]:
	s += 1
	next_l = l + 1
	if s > a[5]:
		u[5] = True
		next_l -= 1
	if s > a[1]:
		u[1] = True
		next_l -= 1
	if s == a[2] + a[1]:
		u[3] = True
	if s == a[4] + a[5]:
		u[3] = True
	tr += l + next_l
	l = next_l
print(tr)


a = [int(e) for e in input().strip().split()]
l = (a[0] + a[1] + a[2]) ** 2
n_triangles = l - a[4] ** 2 - a[0] ** 2 - a[2] ** 2
print(n_triangles)


def main():
	arr = [int(i) for i in input().split()]
	maximum = -1
	arr = arr + arr + arr
	ind = -1
	for i in range(6, 12):
		if arr[i] > maximum:
			maximum = arr[i]
			ind = i
	i = ind
	ans = (arr[i] + arr[i + 1] + arr[i - 1]) * (arr[i] + arr[i + 1] + arr[i - 1]) - arr[i - 3] * arr[i - 3] - arr[i - 1] * arr[i - 1] - arr[i + 1] * arr[i + 1]
	print(ans)
main()


(a, b, c, d, e, f) = [int(w) for w in input().split()]
s = min(a + b + c, d + e + f)
(g, h, i) = [min(a, d), min(b, e), min(c, f)]
ans = s * s - g * g - h * h - i * i
print(ans)


def tri(s):
	return s * s
(a, b, c, d, e, f) = map(int, input().split())
print(tri(a + b + c) - tri(a) - tri(c) - tri(e))


import math

def triArea(x1, y1, x2, y2, x3, y3):
	return abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2)
a = [int(x) for x in input().split()]
l = []
l2 = []
l.append(a[0])
l2.append(0)
for i in range(len(a)):
	if i == 0:
		continue
	l.append(l[len(l) - 1] + a[i] * math.cos(i * math.pi / 3))
	l2.append(l2[len(l2) - 1] + a[i] * math.sin(i * math.pi / 3))
area = 0
for i in range(len(l) - 1):
	if i == 0:
		continue
	area += triArea(l[0], l2[0], l[i], l2[i], l[i + 1], l2[i + 1])
print(round(area / (math.sqrt(3) / 4)))


r = lambda : input()
rr = lambda : map(int, r().split())
(a1, a2, a3, a4, a5, a6) = rr()
S = 0
now = 2 * a1 + 1
L = a2 + a3
L1 = min(a2, a6)
L3 = min(a3, a5)
L2 = L - L1 - L3
for _ in range(L1):
	S += now
	now += 2
S += (now - 1) * L2
for _ in range(L3):
	now -= 2
	S += now
print(S)


x = list(map(int, input().split()))

def area(s):
	return s * s
biggie = area(x[1] + x[2] + x[3])
smalls = area(x[1]) + area(x[3]) + area(x[5])
print(biggie - smalls)


(a1, a2, a3, a4, a5, a6) = list(map(int, input().strip().split()))
ans = (a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2
print(ans)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
from decimal import *
getcontext().prec = 100
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def dist(x, y, c, d):
	return mt.sqrt((x - c) ** 2 + (y - d) ** 2)

def circle(x1, y1, x2, y2, r1, r2):
	distSq = ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5
	if distSq + r2 <= r1:
		return True
	else:
		return False
(a, b, c, d, e, f) = M()
print((a + b + c) ** 2 - a ** 2 - c ** 2 - e ** 2)


def sqr(x: int) -> int:
	return x * x
(a, b, c, d, e, f) = list(map(int, input().split()))
if a == b == c == d == e == f:
	print(sqr(a) * 6)
else:
	print(sqr(a + b + c) - sqr(a) - sqr(c) - sqr(e))


def tri(a):
	return a * a
(a1, a2, a3, a4, a5, a6) = map(int, input().split())
print(tri(a1 + a2 + a3) - tri(a1) - tri(a3) - tri(a5))


sides = list(map(int, input().split()))
c0 = (0, 0)
c1 = (sides[0], 0)
c2 = (c1[0] + sides[1] / 2, 0.5 * 3 ** 0.5 * sides[1])
c3 = (c2[0] - sides[2] / 2, c2[1] + sides[2] * 0.5 * 3 ** 0.5)
c4 = (c3[0] - sides[3], c3[1])
c5 = (c4[0] - sides[4] * 0.5, c4[1] - sides[4] * 0.5 * 3 ** 0.5)
c6 = (c5[0] + sides[5] * 0.5, c5[1] - sides[5] * 0.5 * 3 ** 0.5)
area1 = c0[0] * c1[1] + c1[0] * c2[1] + c2[0] * c3[1] + c3[0] * c4[1] + c4[0] * c5[1] + c5[0] * c0[1]
area2 = c0[1] * c1[0] + c1[1] * c2[0] + c2[1] * c3[0] + c3[1] * c4[0] + c4[1] * c5[0] + c5[1] * c0[0]
print(int(round((area1 - area2) / 2 / 3 ** 0.5 * 4)))


def triang(n):
	a = 0
	i = 1
	while i <= n:
		a += 2 * i - 1
		i += 1
	return a
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
c = a[0] + a[1] + a[5]
print(triang(c) - triang(a[1]) - triang(a[3]) - triang(a[5]))


l = list(map(int, input().split()))
V = (l[0] + l[1] + l[2]) ** 2
print(V - l[0] ** 2 - l[2] ** 2 - l[4] ** 2)


def numtri(sides):
	side_tri = sum(sides[:3])
	area = side_tri * side_tri
	return area - sides[0] ** 2 - sides[2] ** 2 - sides[4] ** 2
a = list(map(int, input().split()))
print(numtri(a))


def triangle_one(b):
	(hell, res) = (1, 0)
	for i in range(b):
		res += hell
		hell += 2
	return res
a = [int(x) for x in input().split()]
over = triangle_one(a[0] + a[1] + a[2])
exc = triangle_one(a[0]) + triangle_one(a[2]) + triangle_one(a[4])
print(over - exc)


def answer(a1, a2, a3, a4, a5, a6):
	return (a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2
(a1, a2, a3, a4, a5, a6) = map(int, input().split())
print(answer(a1, a2, a3, a4, a5, a6))


(a, b, c, d, e, f) = map(int, input().split())
(g, h, i, j, k, l) = (1, 1, 1, 1, 1, 1)
ans = 6
ans = ans + (a - g) * (h + i) * 2
j = g = a
ans = ans + (b - h) * (j + i) * 2
k = h = b
ans = ans + (c - i) * (j + k) * 2
l = i = c
if e < b:
	x = b - 1
	while x >= e:
		ans += 2 * x + 1
		x -= 1
elif e > b:
	x = b
	while x < e:
		ans -= 2 * x + 1
		x += 1
print(ans)


a = [int(c) for c in input().split()]
inc = a[0]
total = 0
while a[1] != 0 and a[5] != 0:
	total += 2 * inc + 1
	a[1] -= 1
	a[5] -= 1
	inc += 1
if a[1] == 0 and a[5] == 0:
	inc -= 1
	for i in range(a[2]):
		total += 2 * inc + 1
		inc -= 1
else:
	b = max(a[1], a[5])
	for i in range(b):
		total += 2 * inc
	inc -= 1
	for i in range(min(a[2], a[4])):
		total += 2 * inc + 1
		inc -= 1
print(total)


a = list(map(int, input().split()))
cnt = 0
l = a[0]
for i in range(min(a[1], a[5])):
	cnt += (l + i) * 2 + 1
l = a[0] + min(a[1], a[5])
if a[1] != a[5]:
	for i in range(max(a[1], a[5]) - min(a[1], a[5])):
		cnt += l * 2
for i in range(l - a[3]):
	cnt += (l - i) * 2 - 1
print(cnt)


def main():
	hexagon = list(map(int, input().split()))
	big_triangle_bottom = sum(hexagon[2:5])
	big_triangle_square = big_triangle_bottom ** 2
	print(big_triangle_square - sum(map(lambda x: x ** 2, hexagon[::2])))
main()


x = list(map(int, input().split(' ')))
(l1, l2) = (x[1], x[0])
(bot, up) = (x[2], x[5])
(r1, r2) = (x[3], x[4])
result = 0
cur = bot
for _ in range(min(l1, r1)):
	result += cur
	cur += 1
	result += cur
for _ in range(abs(r1 - l1)):
	result += cur * 2
for _ in range(min(l2, r2)):
	result += cur
	cur -= 1
	result += cur
print(result)


a = [int(x) for x in input().split()]
ans = 0
while max(a) > 1:
	i = 0
	while a[i] == 1:
		i += 1
	a[i] -= 1
	if a[(i + 3) % 6] != 1:
		ans += (a[(i + 1) % 6] + a[(i + 2) % 6]) * 2
		a[(i + 3) % 6] -= 1
		continue
	if a[(i + 2) % 6] != 1:
		ans += a[(i + 1) % 6] * 2 + 1
		a[(i + 1) % 6] += 1
		a[(i + 2) % 6] -= 1
		continue
	ans += a[(i - 1) % 6] * 2 + 1
	a[(i - 1) % 6] += 1
	a[(i - 2) % 6] -= 1
print(ans + 6)


import math
a = [int(x) for x in input().split()]
nb_triangles = 0
nb_triangles += a[0] * a[1] * 2
nb_triangles += a[2] * a[3] * 2
nb_triangles += a[4] * a[5] * 2
nb_triangles += abs(a[0] - a[3]) ** 2
print(nb_triangles)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def solve():
	(a1, a2, a3, a4, a5, a6) = aj()
	print((a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


a = list(map(int, input().split()))
d = a[0]
p = 1 + 2 * (d - 1)
x = (1 + p) * d // 2
d = a[2]
p = 1 + 2 * (d - 1)
y = (1 + p) * d // 2
d = a[4]
p = 1 + 2 * (d - 1)
z = (1 + p) * d // 2
b = a[0] + a[5] + a[4]
p = 1 + 2 * (b - 1)
s = (1 + p) * b // 2
print(s - x - y - z)


a = list(map(int, input().split(' ')))
r = (a[0] + a[1] + a[2]) ** 2 - a[0] ** 2 - a[2] ** 2 - a[4] ** 2
print(r)


square = lambda x: x * x
a = list(map(int, input().split()))
print(square(a[0] + a[1] + a[2]) - square(a[0]) - square(a[2]) - square(a[4]))


a = list(map(int, input().split()))
mx = 0
i = 0
for j in range(6):
	k = a[(i - 1) % 6] + a[(i - 0) % 6] + a[(i + 1) % 6]
	if mx < k:
		mx = k
		i = j
n = mx
f = lambda n: n ** 2
print(f(n) - f(a[(i + 1) % 6]) - f(a[(i + 3) % 6]) - f(a[(i + 5) % 6]))


sides = [int(x) for x in input().split()]
bigtriangle = (sides[0] + sides[1] + sides[2]) ** 2
ans = bigtriangle - sides[0] ** 2 - sides[2] ** 2 - sides[4] ** 2
print(ans)


a = [0] + list(map(int, input().split()))
sin120 = 3 ** 0.5 / 2
cos120 = -0.5
S1 = a[1] * a[2] * sin120 / 2
S2 = a[3] * a[4] * sin120 / 2
S3 = a[5] * a[6] * sin120 / 2
S = S1 + S2 + S3
x = (a[1] ** 2 + a[2] ** 2 - 2 * a[1] * a[2] * cos120) ** 0.5
y = (a[3] ** 2 + a[4] ** 2 - 2 * a[3] * a[4] * cos120) ** 0.5
z = (a[5] ** 2 + a[6] ** 2 - 2 * a[5] * a[6] * cos120) ** 0.5
p = (x + y + z) / 2
S += (p * (p - x) * (p - y) * (p - z)) ** 0.5
from math import *
print(round(S / (3 ** 0.5 / 4)))


import sys
import math
(a, b, c, d, e, f) = map(int, input().split())
s = a + b + c
print(s ** 2 - a ** 2 - c ** 2 - e ** 2)
sys.exit()


l = list(map(int, input().split()))
x = l[0] + l[1] + l[2]
print(x ** 2 - l[0] ** 2 - l[2] ** 2 - l[4] ** 2)


import math
import collections
import bisect
import heapq
import time
import random
a = [int(x) for x in input().split()]
print(sum(a[:3]) ** 2 - a[0] ** 2 - a[2] ** 2 - a[4] ** 2)


def intSqrt(x):
	a = 1
	b = x
	while a < b:
		c = (a + b) // 2
		if c * c > x:
			b = c
		elif abs(c * c - x) < 0.1:
			a = c
			break
		else:
			a = c + 1
	return a
a = [int(x) for x in input().split()]
area = sum([a[i] * a[i + 1] for i in range(0, 6, 2)])
sides = [(a[i] ** 2 + a[i + 1] ** 2 + a[i] * a[i + 1]) ** 0.5 for i in range(0, 6, 2)]
semi = sum(sides) / 2
print(area + int(intSqrt(16 * semi * (semi - sides[0]) * (semi - sides[1]) * (semi - sides[2]) / 3)))


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
e1 = (a1 + a2 + a3) ** 2
e2 = a1 ** 2
e3 = a3 ** 2
e4 = a5 ** 2
print(e1 - e2 - e3 - e4)


def solve(a, b, c, d, e, f) -> bool:

	def tri(n):
		return n + n * (n - 1)
	l = a + b + c
	return tri(l) - (tri(a) + tri(c) + tri(e))

def getinput():

	def getints_line():
		return list(map(int, input().split(' ')))
	return getints_line()

def test():
	art = Assert()
	art.equal(solve(1, 1, 1, 1, 1, 1), 6)
	art.equal(solve(1, 2, 1, 2, 1, 2), 13)
	art.equal(solve(2, 1, 2, 1, 2, 1), 13)
	art.equal(solve(2, 2, 2, 2, 2, 2), 24)
	art.equal(solve(2, 3, 2, 3, 2, 3), 37)
	art.equal(solve(3, 3, 3, 3, 3, 3), 54)

def main():
	print(solve(*getinput()))
import unittest

class Assert(unittest.TestCase):

	def equal(self, a, b):
		self.assertEqual(a, b)
main()


(a, b, c, d, e, f) = map(int, input().split())
ca = a * 2 + 1
lo = 1
hi = min(b, f)
l = hi - lo + 1
sol = ca * l + l * (l - 1)
ca = a * 2 + 1 + l + (l - 1)
lo = hi + 1
hi = max(b, f)
l = hi - lo + 1
sol += ca * l
ca = d * 2 + 1
lo = 1
hi = min(c, e)
l = hi - lo + 1
sol += ca * l + l * (l - 1)
print(sol)


sides = input().split()
a = int(sides[0])
b = int(sides[1])
c = int(sides[2])
d = int(sides[3])
e = int(sides[4])
answer = 2 * d + 1
toadd = 2 * d + 1
changec = c - 1
changee = e - 1
for i in range(b + c - 1):
	if changec > 0:
		toadd += 1
	elif changec == 0:
		toadd += 0
	else:
		toadd -= 1
	if changee > 0:
		toadd += 1
	elif changee == 0:
		toadd += 0
	else:
		toadd -= 1
	answer += toadd
	changec -= 1
	changee -= 1
print(answer)


a = list(map(int, input().split()))
print(sum(a[:3]) ** 2 - sum([p ** 2 for p in a[::2]]))


def main():
	a = list(map(int, input().split()))
	ans = sum(a[:3]) ** 2 - sum([a[i] * a[i] for i in range(0, 6, 2)])
	print(ans)
	return
main()


(a, b, c, d, e, f) = [int(x) for x in list(input().split())]
print((a + b + c) ** 2 - a ** 2 - c ** 2 - e ** 2)


a = [int(i) for i in input().split()]
triangles = min(a[1], a[3]) * (2 * a[2] + min(a[1], a[3])) + 2 * abs(a[3] - a[1]) * (a[2] + min(a[1], a[3])) + min(a[0], a[4]) * (2 * a[5] + min(a[0], a[4]))
print(triangles)


l = [int(n) for n in input().split()]
print((l[0] + l[1] + l[2]) ** 2 - l[4] ** 2 - l[0] ** 2 - l[2] ** 2)


def solve():
	a = [int(_) for _ in input().split()]
	print((a[0] + a[1] + a[2]) ** 2 - a[0] ** 2 - a[2] ** 2 - a[4] ** 2)
solve()


import sys, math
(a1, a2, a3, a4, a5, a6) = map(int, sys.stdin.readline().split())
print((a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
a = list(map(int, input().split()))
ans = a[0]
for i in range(a[0] + 1, a[0] + min(a[1], a[-1])):
	ans += 2 * i
for i in range(a[3] + min(a[2], a[4]), a[3], -1):
	ans += i * 2
ans += a[3] + abs(a[1] - a[-1]) * (a[0] + min(a[1], a[-1])) * 2
print(ans)


H = input().split()
H = [int(x) for x in H]
leftSum = 1
rightSum = 1
leftIndex = 1
rightIndex = 3
baseNum = H[2]
sum = 0
while leftIndex >= 0 and rightIndex <= 4:
	sum += baseNum * 2 - 1 + leftSum + rightSum
	if leftSum == 1 and rightSum == 1:
		baseNum += 1
	if leftSum == 0 and rightSum == 0:
		baseNum -= 1
	H[leftIndex] -= 1
	H[rightIndex] -= 1
	if H[leftIndex] == 0:
		leftSum = 0
		leftIndex -= 1
	if H[rightIndex] == 0:
		rightSum = 0
		rightIndex += 1
print(sum)


x = list(map(int, input().split()))
print((x[1] + x[2] + x[3]) ** 2 - x[1] * x[1] - x[3] * x[3] - x[5] * x[5])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 6 + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(10 ** 6 + 1):
		if prime[i]:
			for j in range(2 * i, 10 ** 6 + 1, i):
				prime[j] = 0
	return prime
(a, b, c, d, e, f) = L()
print((a + b + c) ** 2 - a * a - c * c - e * e)
endtime = time.time()


import math

def get_n():
	return int(input())

def get_int_vector():
	return [int(x) for x in input().split()]

def list2string(list):
	result = []
	for i in list:
		result.append(str(i))
	return ':'.join(result)

def string2vector(string):
	return [int(x) for x in string.split(':')]
a = get_int_vector()
print((a[0] + a[1] + a[2]) ** 2 - a[0] ** 2 - a[2] ** 2 - a[4] ** 2)


def trin(n):
	return n * n
l = [int(x) for x in input().split()]
a = l[-1]
b = l[1]
c = trin(l[0] + l[1] + l[2])
c = c - trin(l[0]) - trin(l[2]) - trin(l[4])
print(c)


from math import sqrt
from fractions import Fraction

def g(s):
	return sqrt(s * 3 / 2 * (s * 3 / 2 - s) ** 3)
a = [float(i) for i in input().split()]
f = g(a[0] + a[1] + a[2])
print(int(round((f - g(a[0]) - g(a[2]) - g(a[4])) / g(1), 0)))


some_var = 'some___text___'
(a, b, c, d, e, f) = [int(i) for i in input().split(' ')]
print((a + b + c) * (a + b + c) - a * a - c * c - e * e)


a = list(map(int, input().split()))
print(pow(a[0] + a[1] + a[2], 2) - pow(a[0], 2) - pow(a[2], 2) - pow(a[4], 2))


(a_1, a_2, a_3, a_4, a_5, a_6) = [int(i) for i in input().split()]
print(a_1 * a_2 + a_4 * a_5 + (a_1 + a_2) * (a_3 + a_6))


l = list(map(int, input().split()))
x = [0] * 7
y = [0] * 7
x[1] = l[0]
(x[2], y[2]) = (x[1] + l[1] / 2, y[1] + l[1] * 3 ** 0.5 / 2)
(x[3], y[3]) = (x[2] - l[2] / 2, y[2] + l[2] * 3 ** 0.5 / 2)
(x[4], y[4]) = (x[3] - l[3], y[3])
(x[5], y[5]) = (-l[5] / 2, l[5] * 3 ** 0.5 / 2)
s = 0
for i in range(1, 7):
	s += (y[i] + y[i - 1]) * (x[i] - x[i - 1]) / 2
print(round(abs(s) * 4 / 3 ** 0.5))


(a, b, c, d, e, f) = map(int, input().split(' '))
t = a + b + c
u = c + d + e
v = e + f + a
if t == u == v:
	print(int(4 * (t ** 2 / 4 - a ** 2 / 4 - c ** 2 / 4 - e ** 2 / 4)))
	quit()
ff = b + c + d
gg = d + e + f
hh = f + a + b
print(int(4 * (ff ** 2 / 4 - b ** 2 / 4 - d ** 2 / 4 - f ** 2 / 4)))


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def tringles(n):
	return 3 + (n - 1) * 2
sides = array()
(a, l1, r1) = (sides[0], sides[5], sides[1])
(b, l2, r2) = (sides[3], sides[2], sides[4])
ans = 0
for i in range(min(l1, r1)):
	ans += tringles(a + i)
for i in range(min(l2, r2)):
	ans += tringles(b + i)
layers = abs(l1 - r1)
ans += layers * (a + min(l1, r1)) * 2
print(ans)


(a, b, c, d, e, f) = map(int, input().split())
n = a + b + c
print(n * n - a * a - c * c - e * e)


s = input()
a = [0] * 6
for i in range(0, 6):
	a[i] = int(s.split()[i])
ans = (a[0] + a[1] + a[5]) ** 2 - a[1] ** 2 - a[3] ** 2 - a[5] ** 2
print(ans)


A = list(map(int, input().split()))
ans = (A[0] + A[1] + A[2]) ** 2
ans -= A[0] ** 2
ans -= A[2] ** 2
ans -= A[4] ** 2
print(ans)


liste = list(map(int, input().split(' ')))
number = (liste[0] + liste[1] + liste[2]) ** 2 - liste[0] ** 2 - liste[2] ** 2 - liste[4] ** 2
print(number)


import sys
import string
import math
import heapq
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def main():
	(a, b, c, d, e, f) = lmi(line())
	a1 = (a + b + c) ** 2 - (a ** 2 + c ** 2 + e ** 2)
	print(a1)
main()


def solve(a):
	length_of_side = sum(a[:3])
	return length_of_side ** 2 - (a[0] ** 2 + a[2] ** 2 + a[4] ** 2)
a = list(map(int, input().split()))
r = solve(a)
print(r)


import unittest
import sys

class Hexagon:

	def __init__(self, args):
		self.nums = args
		self.bottom = self.nums[0]
		self.bi = 0
		for i in range(6):
			if self.nums[i] > self.bottom:
				self.bottom = self.nums[i]
				self.bi = i
		self.ll = self.nums[(self.bi - 1 + 6) % 6]
		self.hl = self.nums[(self.bi - 2 + 6) % 6]
		self.lr = self.nums[(self.bi + 1 + 6) % 6]
		self.ill = self.ll
		self.ilr = self.lr
		self.ihl = self.hl
		self.ib = self.bottom
		self.low = 0
		while self.ill > 0:
			if self.ilr <= 0:
				self.low += self.ib * 2
			else:
				self.low += self.ib * 2 + 1
				self.ib += 1
				self.ilr -= 1
			self.ill -= 1
		self.hi = 0
		while self.ihl > 0:
			if self.ilr <= 0:
				self.hi += self.ib * 2 - 1
				self.ib -= 1
			else:
				self.hi += self.ib * 2
				self.ilr -= 1
			self.ihl -= 1

	def calculate(self):
		result = self.low + self.hi
		return str(result)

def get_inputs(test_inputs=None):
	it = iter(test_inputs.split('\n')) if test_inputs else None

	def uinput():
		if it:
			return next(it)
		else:
			return sys.stdin.readline()
	imax = 6
	nums = list(map(int, uinput().split()))
	return nums

def calculate(test_inputs=None):
	return Hexagon(get_inputs(test_inputs)).calculate()

class unitTests(unittest.TestCase):

	def test_Hexagon_class__basic_functions(self):
		d = Hexagon([2, 1, 3, 2, 1, 3])
		self.assertEqual(d.bottom, 3)
		self.assertEqual(d.ll, 1)
		self.assertEqual(d.hl, 2)
		self.assertEqual(d.lr, 2)
		self.assertEqual(d.low, 7)
		self.assertEqual(d.hi, 15)

	def test_sample_tests(self):
		test = '1 1 1 1 1 1'
		self.assertEqual(calculate(test), '6')
		self.assertEqual(list(get_inputs(test)), [1, 1, 1, 1, 1, 1])
		test = '1 2 1 2 1 2'
		self.assertEqual(calculate(test), '13')
		test = '3 2 1 3 2 1'
		self.assertEqual(calculate(test), '22')
		test = '3 1 2 3 1 2'
		self.assertEqual(calculate(test), '22')
		test = '4 1 2 3 2 1'
		self.assertEqual(calculate(test), '25')

	def test_time_limit_test(self):
		import random
		test = '1000 900 999 990 999 1000'
		import timeit
		start = timeit.default_timer()
		args = get_inputs(test)
		init = timeit.default_timer()
		d = Hexagon(args)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTime Test: ' + '{0:.3f}s (inp {1:.3f}s init {2:.3f}s calc {3:.3f}s)'.format(stop - start, init - start, calc - init, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(calculate())


(base, s1, height, _, _, s2) = map(int, input().split())
height += s1
at_level = 2 * base - 1
total = 0
for i in range(height):
	if i < s1:
		at_level += 1
	elif i > s1:
		at_level -= 1
	if i < s2:
		at_level += 1
	elif i > s2:
		at_level -= 1
	total += at_level
print(total)


s = input().split()
a = s[0]
b = s[1]
c = s[2]
d = s[3]
e = s[4]
f = s[5]
hasil = (int(a) + int(b) + int(f)) ** 2 - (int(b) ** 2 + int(d) ** 2 + int(f) ** 2)
print(hasil)


arr = list(map(int, input().split()))

def Foo(element):
	return element ** 2
print(Foo(arr[0] + arr[1] + arr[2]) - Foo(arr[0]) - Foo(arr[2]) - Foo(arr[4]))


u = input().split()
a = int(u[0])
c = int(u[2])
d = int(u[3])
e = int(u[4])
print((c + d + e) * (c + d + e) - a * a - c * c - e * e)


a = [int(x) for x in input().split()]
ans = 0
ans += (2 * a[0] + min(a[1], a[5])) * min(a[1], a[5])
ans += (2 * a[0] + 2 * min(a[1], a[5])) * (max(a[1], a[5]) - min(a[1], a[5]))
ans += (a[0] + min(a[1], a[5]) + a[3]) * min(a[2], a[4])
print(ans)


from sys import stdin
from collections import defaultdict
ws = list(map(int, stdin.buffer.readline().split()))
base_w = ws[0]
side_w = ws[1] + ws[2]
ans = base_w * side_w * 2 + side_w ** 2 - ws[2] ** 2 - ws[4] ** 2
print(ans)


def f(k):
	Sum = 1
	x = 1
	for i in range(k):
		x += 2
		Sum += x
	return Sum
m = list(map(int, input().split()))
l = m[0] + m[1] + m[2] - 1
print(f(l) - f(m[0] - 1) - f(m[2] - 1) - f(m[4] - 1))


def main():
	(a1, a2, a3, a4, a5, a6) = map(int, input().split())
	ans = (a1 + a2 + a3) ** 2 - a1 ** 2 - a3 ** 2 - a5 ** 2
	print(ans)
main()


s = [int(x) for x in input().split()]
tot = s[1] + s[2]
a1 = min(s[1], s[5])
a2 = max(s[1], s[5])
fin = [0] * (tot + 1)
fin[0] = s[0]
i = 1
while i <= a1:
	fin[i] = fin[i - 1] + 1
	i += 1
while i <= a2:
	fin[i] = fin[i - 1]
	i += 1
while i <= tot:
	fin[i] = fin[i - 1] - 1
	i += 1
ans = 0
for i in range(tot):
	ans += fin[i] + fin[i + 1]
print(ans)


a = list(map(int, input().split()))
(prv, v) = (a[0], 0)
while a[2]:
	nxt = prv - 1
	if a[1]:
		nxt += 1
		a[1] -= 1
	else:
		a[2] -= 1
	if a[5]:
		nxt += 1
		a[5] -= 1
	else:
		a[4] -= 1
	v += prv + nxt
	prv = nxt
print(v)