from itertools import permutations L = map(int, raw_input().split()) color = map(int, raw_input().split()) mn = float("inf") for ls in permutations(L): total = 0 for i in xrange(3): total += (ls[i] * 2 + ls[(i + 1) % 3] * 2) * color[i] mn = min(total, mn) print mn