import std.algorithm, std.array, std.container, std.range; import std.string, std.conv, std.math, std.random; import std.stdio, std.typecons; void main() { auto ci = iota(26).map!(i => readln.chomp.to!int).array; auto r = 1; r *= ci['h' - 'a']; r *= ci['e' - 'a']; r *= ci['w' - 'a']; r *= ci['r' - 'a']; r *= ci['d' - 'a']; r *= calc_o(ci['o' - 'a']); r *= calc_l(ci['l' - 'a']); writeln(r); } int calc_o(int n) { return iota(1, n).map!(x => x * (n - x)).reduce!(max); } int calc_l(int n) { return iota(2, n).map!(x => x * (x - 1) / 2 * (n - x)).reduce!(max); }