import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] C = new int[26]; for(int i = 0; i < 26; i++) { C[i] = scan.nextInt(); } scan.close(); // d e h l o r w // 3 4 7 11 14 17 22 long ans = C[3] * C[4] * C[7] * C[17] * C[22]; long max1 = 0; for(int i = 2; i < C[11]; i++) { long t = comb(i, 2) * (C[11] - i); max1 = Math.max(max1, t); } long max2 = 0; for(int i = 1; i < C[14]; i++) { long t = i * (C[14] - i); max2 = Math.max(max2, t); } ans = ans * max1 * max2; System.out.println(ans); } public static long comb(int n, int r) { if (n - r < r) r = n - r; if (r == 0) return 1; if (r == 1) return n; int[] num = new int[r]; int[] den = new int[r]; for (int k = 0; k < r; k++){ num[k] = n - r + k + 1; den[k] = k + 1; } for (int p = 2; p <= r; p++) { int pivot = den[p - 1]; if (pivot > 1) { int offset = (n - r) % p; for (int k = p - 1; k < r; k += p) { num[k - offset] /= pivot; den[k] /= pivot; } } } long result = 1; for (int k = 0; k < r; k++) { if (num[k] > 1) result *= num[k]; } return result; } }