L = sorted(map(int,raw_input().split())) C = sorted(map(int,raw_input().split())) print sum(C[i]*(L[(i+1)%3]+L[(i+2)%3])*2 for i in range(3))