L1,L2,L3=map(int,raw_input().split()) colors=map(int,raw_input().split()) length=[L1+L2,L2+L3,L3+L1] length.sort() colors.sort() colors.reverse() ans = 0 for c,l in zip(colors,length): ans+=c*l*2 print ans