#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <list> #include <queue> #include <vector> #include <complex> #include <set> ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<<endl; ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(6);// LL C[26]; rep(i,26){ cin>>C[i]; } LL ans = 1; LL ama = 0; LL big = -1; LL tbig = 0; if(C['d'-'a'] < 1){P(0);return 0;} else{ans *= C['d'-'a'];} if(C['e'-'a'] < 1){P(0);return 0;} else{ans *= C['e'-'a'];} if(C['h'-'a'] < 1){P(0);return 0;} else{ans *= C['h'-'a'];} if(C['r'-'a'] < 1){P(0);return 0;} else{ans *= C['r'-'a'];} if(C['w'-'a'] < 1){P(0);return 0;} else{ans *= C['w'-'a'];} //*99^4 if(C['o'-'a'] < 2){P(0);return 0;} else{ ama = C['o'-'a']-2; ans *= (1+ama/2)*(1+ama-ama/2); } //*2550 if(C['l'-'a'] < 3){P(0);return 0;} else{ ama = C['l'-'a'] - 3 ; for(int k=0;k<=ama;++k){ tbig = ((k+2)*(k+1)/2) * (ama-k+1); if(big == -1 || big < tbig){ big = tbig; } } ans *= big; } //*72963 P(ans); return 0; }