L1, L2, L3 = map(int,input().split()) R, B, Y = sorted(map(int, input().split())) S = sorted([L1+L2, L2+L3, L3+L1]) print(2*(S[0]*Y + S[1]*B + S[2]*R))