import std.stdio, std.conv, std.math, std.string, std.range, std.array, std.algorithm; void main() { auto L = readln().strip().split().map!(to!int)().array(); auto C = readln().strip().split().map!(to!int)().array(); auto ol = [L[0]+L[1], L[1]+L[2], L[0]+L[2]]; C.sort(); ol.sort!"a>b"(); ol[] *= C[]; (ol.reduce!"a+b"()*2).writeln(); }