L = map(int,raw_input().split()) print sum(l*c*2 for l,c in zip(sorted(sum(L)-i for i in L),sorted(map(int,raw_input().split()),reverse=True)))