import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] alpha = new int[26]; for(int i = 0; i < 26; i++){ alpha[i] = sc.nextInt(); } long answer = 1; answer *= alpha['h' - 'a']; //h answer *= alpha['e' - 'a']; //e // ll - l if(alpha['l' - 'a'] < 3){ answer = 0; }else{ int max = 0; final int l = alpha['l' - 'a']; for(int i = 2; i <= l - 1; i++){ final int comb = i; final int rest = l - i; max = Math.max(max, comb * (comb - 1) / 2 * rest); } answer *= max; } answer *= alpha['w' - 'a']; //w answer *= alpha['r' - 'a']; //r answer *= alpha['d' - 'a']; //d if(alpha['o' - 'a'] < 2){ answer = 0; }else{ final int o = alpha['o' - 'a']; answer *= (o % 2 == 0 ? (o / 2 * o / 2) : (o / 2 * (o / 2 + 1))); } System.out.println(answer); } }