package no073; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] c = new int[128]; for(int i=0;i<26;i++) { c[i + 'a'] = sc.nextInt(); } long num = 1; num *= c['h'] * c['e'] * c['w'] * c['r'] * c['d']; int o = c['o']; num *= (o/2) * (o-o/2); int l = c['l']; if (l == 0) { num = 0; }else{ long max = 0; for(int i=1;i