import sys def input(): return sys.stdin.readline().rstrip('\n') def main(): a, b, c = map(int, input().split()) x, y, z = map(int, input().split()) a, b, c = sorted([a + a + b + b, a + a + c + c, b + b + c + c]) x, y, z = sorted([x, y, z]) return a * z + b * y + c * x if __name__ == '__main__': ret = main() if ret is not None: print(ret)