def fact(x): if x == 0: return 1 return x * fact(x - 1) def combi(r, c): return fact(r) / fact(c) / fact(r - c) def l_max(x): res = 0 for i in range(2, x): res = max(res, combi(i, 2) * (x - i)) return res C = [input() for i in range(26)] ans = 1 for i in map(lambda x: ord(x) - ord('a'), 'dehrw'): ans *= C[i] x = C[ord('o') - ord('a')] ans *= (x/2) * (x - x/2) ans *= l_max(C[ord('l') - ord('a')]) if ans < 1: print(0) else: print(ans)