#include using namespace std; #define int long long #define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++) #define all(x) (x).begin(),(x).end() #define sz(x) ((int)x.size()) templatebool chmax(T &a,T b){if(abool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;} typedef pair pii; typedef vector vi; typedef vector vvi; const int inf = 1LL<<60; const int mod = 1e9 + 7; const double eps = 1e-9; /*{ }*/ signed main(){ vi c(26); rep(i, 0, 26) cin >> c[i]; int ans = c['l'] > 2; rep(i, 2, c['l'-'a']){ rep(j, 1, c['o'-'a']){ int k = c['l'-'a'] - i; int l = c['o'-'a'] - j; int tmp = i*(i-1)/2 * j * k * l; chmax(ans, tmp); } } ans *= c['h'-'a']; ans *= c['e'-'a']; ans *= c['w'-'a']; ans *= c['r'-'a']; ans *= c['d'-'a']; cout << ans << endl; return 0; }