a = map(int, raw_input().split()) b = sorted([a[i-1]*2+a[i]*2 for i in xrange(3)]) c = map(int, raw_input().split()) print sum(d*e for d, e in zip(b, c))