a,b,c=map(int,input().split()) r,B,y=sorted(map(int,input().split())) s=sorted([a+b,b+c,c+a]) print(2*(s[0]*y+s[1]*B+s[2]*r))