L1, L2, L3 = map(int, input().split()) Q = list(map(int, input().split())) LS = [(L1 + L2) * 2, (L2 + L3) * 2, (L3 + L1) * 2] LS.sort() Q.sort() print(LS[0] * Q[2] + LS[1] * Q[1] + LS[2] * Q[0])