import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines a,b,c,d,e,f = map(int,read().split()) x,y,z = sorted([d+e,d+f,e+f]) a,b,c = sorted([a,b,c]) answer = 2 * (a*z+b*y+c*x) print(answer)