#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define BET(a,b,c) ((a)<=(b)&&(b)<(c)) #define FOR(i,n) for(int i=0,i##_end=(int(n));i VI; typedef vector VVI; int main() { VI h(26); FOR(i,26) { int x; cin>>x; h[i] = x; } long long ans = 1; for(auto c : "hewrd"){ ans *= h[c - 'a']; } int oNum = h['o' - 'a']; if(oNum < 2) ans = 0 ; else { long long a = oNum / 2; long long b = oNum - a; ans *= a; ans *= b; } int lNum = h['l' - 'a']; if(lNum < 3) ans = 0 ; else{ long long maxv = 0 ; FOR(i,lNum){ int a = i; int b = lNum - i; long long sub = a * (a - 1) / 2 * b; maxv = max(maxv, sub); } ans *= maxv; } cout<