import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] ls = new int[3]; for (int i=0; i<3; i++) { ls[i] = sc.nextInt(); } int[] rollCnts = new int[3]; for (int i=0; i<3; i++) { rollCnts[i] = sc.nextInt(); } Arrays.sort(ls); // 昇順 Arrays.sort(rollCnts); int ans = 0; ans += rollCnts[2] * ((ls[0] + ls[1]) * 2); ans += rollCnts[1] * ((ls[0] + ls[2]) * 2); ans += rollCnts[0] * ((ls[1] + ls[2]) * 2); System.out.println(ans); } }