import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int size = 3; String[] line1 = br.readLine().split(" "); int[] a = new int[size]; for (int i = 0; i < size; i++) a[i] = Integer.parseInt(line1[i]); String[] line2 = br.readLine().split(" "); int[] b = new int[size]; for (int i = 0; i < size; i++) b[i] = Integer.parseInt(line2[i]); int[] c = new int[]{b[0] + b[1] , b[1] + b[2] , b[2] + b[0]}; Arrays.sort(a); Arrays.sort(c); out(2 * (a[0] * c[2] + a[1] * c[1] + a[2] * c[0])); } }