#include <iostream>
#include <string>

using lint = long long;
const std::string one = "hewrd";

void solve() {
    lint ans = 1;

    for (char c = 'a'; c <= 'z'; ++c) {
        lint x;
        std::cin >> x;

        for (auto d : one) {
            if (c == d) ans *= x;
        }

        if (c == 'o') {
            ans *= (x / 2) * (x - x / 2);
        }

        if (c == 'l') {
            lint max = 0;
            for (int k = 0; k <= x; ++k) {
                max = std::max(max, (x - k) * (x - k - 1) * k / 2);
            }
            ans *= max;
        }
    }

    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}