#!/usr/bin/env python3 import string ALPHAS = string.ascii_lowercase NUM_ALPHAS = len(ALPHAS) def helloworld_num(ctr): res = ctr["h"] * ctr["e"] * ctr["w"] * ctr["r"] * ctr["d"] res *= ctr["o"] // 2 res *= ctr["o"] - ctr["o"] // 2 n = ctr["l"] res *= max(x * (x - 1) * (n - x) // 2 for x in range(n + 1)) return res def main(): ctr = dict(zip(ALPHAS, (int(input()) for _ in range(NUM_ALPHAS)))) print(helloworld_num(ctr)) if __name__ == '__main__': main()