a,b,c = map(int,input().split()) T = sorted(map(int,input().split()))[::-1] L = sorted([2*(a+b),2*(b+c),2*(c+a)]) print(sum(ti*li for ti,li in zip(T,L)))