import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] base = new int[3]; for (int i = 0; i < 3; i++) { base[i] = sc.nextInt(); } int[] lengths = new int[3]; for (int i = 0; i < 3; i++) { lengths[i] = base[i] + base[(i + 1) % 3]; lengths[i] *= 2; } int[] rgb = new int[3]; for (int i = 0; i < 3; i++) { rgb[i] = sc.nextInt(); } int[][] perm = new int[][]{{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; int min = Integer.MAX_VALUE; for (int[] order : perm) { int sum = 0; for (int i = 0; i < 3; i++) { sum += lengths[i] * rgb[order[i]]; } min = Math.min(min, sum); } System.out.println(min); } }