module main; // https://yang33-kassa.jp/yukicoder/yukicoder073/ より import std; void main() { // 入力 long[char] C; foreach (c; lowercase) C[c] = readln.chomp.to!long; // 答えの計算と出力 long ans = 1; "hewrd".each!(c => ans *= C[c]); long O = C['o'], x = (O + 1) / 2; ans *= -x * x + O * x; long ret = 0, L = C['l']; foreach (i; 1 .. L) { long leftL = L - i; ret = max(ret, i * leftL * (leftL - 1) / 2); } ans *= ret; writeln(ans); }