from itertools import permutations L,M,N=map(int,input().split()) R,B,Y=map(int,input().split()) F,G,H=2*(L+M),2*(M+N),2*(N+L) X=float("inf") for S in permutations([R,B,Y]): for T in permutations([F,G,H]): K=0 for i in range(3): K+=S[i]*T[i] X=min(X,K) print(X)