import java.util.Scanner object Problem268 { def main(args: Array[String]) { val sc = new Scanner(System.in) val len = Array.fill(3)(sc.nextInt).sorted val roll = Array.fill(3)(sc.nextInt).sorted(Ordering[Int].reverse) // 最短の長さを一番多く巻く val roll1 = (len(0) + len(1)) * 2 * roll(0) val roll2 = (len(0) + len(2)) * 2 * roll(1) val roll3 = (len(1) + len(2)) * 2 * roll(2) val result = roll1 + roll2 + roll3 println(result) } }