L = list(map(int, input().split())) L = [L[0] + L[1], L[1] + L[2], L[0] + L[2]] L.sort() L.reverse() B = list(map(int, input().split())) B.sort() print((L[0] * B[0] + L[1] * B[1] + L[2] * B[2]) * 2)