import math def nCr(n,r): ncr = 1 for i in range(1,r+1): ncr = int(ncr * (n-i+1)/i) return ncr c = [] for i in range(ord('a'), ord('z')+1): c.append(int(input())) y = int(c[ord('o')-ord('a')]//2) max_hellowolrd = 0 for x in range(1,c[ord('l')-ord('a')]-1): max_hellowolrd = max(max_hellowolrd, c[ord('h')-ord('a')] * c[ord('e')-ord('a')] * nCr(c[ord('l')-ord('a')]-x, 2) * (c[ord('o')-ord('a')]-y) * c[ord('w')-ord('a')] * y * c[ord('r')-ord('a')] * x * c[ord('d')-ord('a')]) print(int(max_hellowolrd))