#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { vector cnt(26, 0); rep(i, 26) cin >> cnt[i]; auto f = [&](char c) -> int { return cnt[c - 'a']; }; // h e ll o w o r l d // hewrd lll oo ll ans = 0; for (int x = 1; x < f('o'); ++x) { for (int y = 1; y < f('l'); ++y) { ans = max(ans, 1LL * f('h') * f('e') * f('w') * f('r') * f('d') * x * (f('o') - x) * y * (y - 1) / 2 * (f('l') - y)); } } cout << ans << endl; return 0; }