import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void swap(T[] array, int fst, int snd){ T tmp = array[fst]; array[fst] = array[snd]; array[snd] = tmp; } public static void reverse(T[] array, int begin, int end){ // [begin, end) for(int i = begin, j = end - 1; i < j; i++, j--) { swap(array, i, j); } } @SafeVarargs public static > boolean next_permutation(T ... perm) { for(int i = perm.length - 1; i > 0; i--){ if(perm[i - 1].compareTo(perm[i]) < 0){ int j = perm.length; while(perm[i - 1].compareTo(perm[--j]) >= 0); swap(perm, i - 1, j); reverse(perm, i, perm.length); // [i, n) return true; } } reverse(perm, 0, perm.length); // [0, n) return false; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); Integer[] lens = {sc.nextInt(), sc.nextInt(), sc.nextInt()}; Arrays.sort(lens); final int R = sc.nextInt(); final int B = sc.nextInt(); final int Y = sc.nextInt(); int min = Integer.MAX_VALUE; do{ final int red = (lens[0] * 2 + lens[2] * 2) * R; final int blue = (lens[0] * 2 + lens[1] * 2) * B; final int yellow = (lens[1] * 2 + lens[2] * 2) * Y; min = Math.min(min, red + blue + yellow); }while(next_permutation(lens)); System.out.println(min); } }