import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] l = new int[3]; for (int i = 0; i < 3; i++) l[i] = Integer.parseInt(sc.next()); Integer[] r = new Integer[3]; for (int i = 0; i < 3; i++) r[i] = Integer.parseInt(sc.next()); Arrays.sort(l); Arrays.sort(r, Comparator.reverseOrder()); int ans = r[0] * (l[0] + l[1]) * 2; if (l[1] + l[2] > l[2] + l[0]) { int t = r[1]; r[1] = r[2]; r[2] = t; } ans += r[1] * (l[1] + l[2]) * 2; ans += r[2] * (l[2] + l[0]) * 2; System.out.println(ans); } }