#include #include using namespace std; int f(int X, int x) { return x * (x-1) * (X-x) / 2; } int main() { int C[128]; for(int a = 'a'; a <= 'z'; ++ a) cin >> C[a]; long long ans = 1; ans *= C['h'], ans *= C['e']; ans *= C['w'], ans *= C['r'], ans *= C['d']; ans *= (C['o'] / 2) * ((C['o'] + 1) / 2); int X = C['l'], l = (int)((X + 1 + sqrt(X * X - X + 1.)) / 3); ans *= max(f(X, l), f(X, l+1)); cout << ans << endl; return 0; }