C = [int(input()) for _ in range(26)]
d = C[3]
e = C[4]
h = C[7]
l = C[11]
o = C[14]
r = C[17]
w = C[22]
ans = d * e * h * r * w
M = 1
for x in range(1,l):
    M = max(M, (x * (x - 1) // 2) * (l - x))
if l < 3:
    M = 0
ans *= M
M = 1
for x in range(1,o):
    M = max(M, x * (o - x))
if o < 2:
    M = 0
ans *= M
print(ans)