L1, L2, L3 = map(int, input().split()) rby = list(map(int, input().split())) l = [2*(L1+L2), 2*(L2+L3), 2*(L3+L1)] l.sort() rby.sort(reverse=True) ans = sum([li*rby_i for li, rby_i in zip(l, rby)]) print(ans)