from itertools import permutations

# Read input
L = list(map(int, input().split()))
R, B, Y = map(int, input().split())

min_total = float('inf')

# Try all permutations of the dimensions
for a, b, c in permutations(L):
    # Calculate the total length for this permutation
    total = 2 * (R * (a + c) + B * (a + b) + Y * (b + c))
    if total < min_total:
        min_total = total

print(min_total)