#include using namespace std; int main() { int C[30] = {}; for (int i = 0; i < 26; i++) { cin >> C[i]; } string s = "hewrd"; long long ans = 1; for (auto& c : s) ans *= C[c - 'a']; int s1, s2; s1 = C['o' - 'a'] / 2; s2 = C['o' - 'a'] - s1; ans *= s1 * s2; int MAX = 0; if (C['l' - 'a'] < 3) MAX = 0; else { for (int i = 2; i < C['l' - 'a']; i++) { MAX = max(MAX, i * (i - 1) / 2 * (C['l' - 'a'] - i)); } } ans *= MAX; cout << ans << endl; }