import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int L1 = sc.nextInt(); int L2 = sc.nextInt(); int L3 = sc.nextInt(); int [] L = {L1+L2,L2+L3,L3+L1}; int [] RBY = new int [3]; for(int i=0; i<3; i++){ RBY[i] = sc.nextInt(); } Arrays.sort(L); Arrays.sort(RBY); int min=0; for(int i=0; i<3; i++){ min+=RBY[i]*L[2-i]; } System.out.println(2*min); } }