int main() { long long a[26]; for(int i = 0; i < 26; ++i) scanf("%lld", &a[i]); long long ans = 1; ans *= a['h' - 'a']; ans *= a['e' - 'a']; ans *= a['w' - 'a']; ans *= a['d' - 'a']; ans *= a['r' - 'a']; ans *= a['o' - 'a'] * a['o' - 'a'] / 4; long long l = 0; for (int i = 2; i < a['l' - 'a']; ++i) { long long left = i * (i - 1) / 2; long long right = a['l' - 'a'] - i; if (left * right > l) l = left * right; } ans *= l; printf("%lld\n", ans); }