import java.util.Scanner; public class Main_yukicoder73 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] c = new int[26]; for (int i = 0; i < 26; i++) { c[i] = sc.nextInt(); } long ret = c['h' - 'a'] * c['e' - 'a'] * c['w' - 'a'] * c['r' - 'a'] * c['d' - 'a']; long tmp = c['o' - 'a'] / 2; ret *= (c['o' - 'a'] - tmp) * tmp; long max = 0; for (long l = 1; l <= c['l' - 'a']; l++) { max = Math.max(max, ret * (c['l' - 'a'] - l) * (c['l' - 'a'] - l - 1) / 2 * l); } System.out.println(max); sc.close(); } }