#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { long long A[26]; char C[5] = { 'h','e','w','r','d' }; for ( int i = 0; i < 26; i++ ) { cin >> A[i]; } long long ans = 1; for ( int i = 0; i < 5; i++ ) { ans *= A[ C[i] - 'a' ]; } ans *= (A[ 'o' - 'a' ] / 2) * ((A[ 'o' - 'a' ]+1) / 2); long long m = 0; for ( long long i = A[ 'l'- 'a' ]-1; i >= 2; i-- ) { m = max( m, (i*(i-1)/2) * (A[ 'l'- 'a' ]-i) ); } ans *= m; cout << ans << endl; return 0; }