x,y,z,*l=map(int,(input()+' '+input()).split()) b=sorted([x+y,y+z,z+x]) l=sorted(l) print((b[0]*l[2]+b[1]*l[1]+b[2]*l[0])*2)