L = list(map(int,input().split())) R,B,Y = map(int,input().split()) P = [(L[0] + L[1]) * 2, (L[0] + L[2]) * 2, (L[1] + L[2]) * 2] Q = [R, B, Y] P.sort() Q.sort() print(P[0] * Q[2] + P[1] * Q[1] + P[2] * Q[0])