#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF 1e9 #define PI acos(-1) typedef long long ll; map cnt; ll ans; int main() { string hello = "helowrd"; for (char i = 'a'; i <= 'z'; i++) { int sub; cin >> sub; cnt[i] = sub; } ans = 1; for (int i = 0; i < 7; i++) { char a = hello[i]; if (a == 'l') { ll c = 0; for (int j = 0; j < cnt['l'] + 1; j++) { ll tmp = 1, x = j, y = cnt['l'] - x; tmp *= x; tmp *= y*(y - 1) / 2; c = max(c, tmp); } ans *= c; } else if (a == 'o') { ll x = cnt['o'] / 2, y=cnt['o']-x; ans *= (x*y); } else ans *= cnt[a]; } cout << ans << endl; return 0; }