#define _GLIBCXX_DEBUG #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef ll li; typedef pair PI; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define REP(i, n) rep (i, n) #define F first #define S second #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define SZ(a) (int)((a).size()) #define ALL(a) (a).begin(),(a).end() #define FLL(a,b) memset((a),b,sizeof(a)) #define CLR(a) memset((a),0,sizeof(a)) #define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it) #define FORR(it,a) for(__typeof(a.rbegin())it=a.rbegin();it!=a.rend();++it) template ostream& operator<< (ostream& out, const pair& val){return out << "(" << val.F << ", " << val.S << ")";} template ostream& operator<< (ostream& out, const vector& val){out << "{";rep(i,SZ(val)) out << (i?", ":"") << val[i];return out << "}";} #define declare(a,it) __typeof(a) it=a const double EPS = 1e-8; const int dx[]={1,0,-1,0,1,1,-1,-1,0}; const int dy[]={0,1,0,-1,-1,1,-1,1,0}; #define endl '\n' int main(int argc, char *argv[]) { int a[26]; rep(i,26) cin >> a[i]; ll ans = 1; ans *= a['h'-'a']; ans *= a['e'-'a']; ans *= a['w'-'a']; ans *= a['r'-'a']; ans *= a['d'-'a']; int o = 1; if(a['o'-'a']<2) o = 0; for(int i = 0; i <= a['o'-'a']; ++i){ o = max(o, i * (a['o'-'a']-i)); } ans *= o; int l = 1; if(a['l'-'a'] < 3) l = 0; for(int i = 0; i <= a['l'-'a']; ++i){ l = max(l, i * (i-1) / 2 * (a['l'-'a']-i)); } ans *= l; cout << ans << endl; return 0; }