import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 3); int[] lengths = new int[3]; for (int i = 0; i < 3; i++) { lengths[i] = Integer.parseInt(first[i]); } int[] total = new int[3]; total[0] = (lengths[0] + lengths[1]) * 2; total[1] = (lengths[1] + lengths[2]) * 2; total[2] = (lengths[2] + lengths[0]) * 2; Arrays.sort(total); String[] second = br.readLine().split(" ", 3); int[] colors = new int[3]; for (int i = 0; i < 3; i++) { colors[i] = Integer.parseInt(second[i]); } Arrays.sort(colors); int ans = colors[0] * total[2] + colors[1] * total[1] + colors[2] * total[0]; System.out.println(ans); } }