def solve(): L = list(map(int, input().split())) R, B, Y = list(map(int, input().split())) x = (L[0] + L[1]) * 2 y = (L[0] + L[2]) * 2 z = (L[1] + L[2]) * 2 l = [x, y, z] l.sort() r = [R, B, Y] r.sort(reverse=True) print(sum(a * b for a, b in zip(l, r))) if __name__ == '__main__': solve()