l1, l2, l3 = map(int, input().split()) RBY = list(map(int, input().split())) from itertools import permutations total = l1 + l2 + l3 ans = 1e18 for pat in permutations([l1, l2, l3]): sub = 0 for i in range(3): sub += RBY[i] * (total - pat[i]) * 2 ans = min(ans, sub) print(ans)