using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { Dictionary cnt = new Dictionary(); for (char c = 'a'; c <= 'z'; c++) { cnt.Add(c, int.Parse(Reader.ReadLine())); } string word = string.Join(string.Empty, "helloworld".Distinct()); long ans = 1; for (int i = 0; i < word.Length; i++) { if(word[i] == 'l') { if(cnt[word[i]]<3) { ans = 0; break; } long tmp = cnt[word[i]] - 3; long tmp2 = 1; for (int j = 1; j <= tmp; j++) { long l1 = 2 + j; long l2 = 1 + tmp - j; long l3 = 2 + tmp - j; long l4 = 1 + j; tmp2 = Math.Max(tmp2, l1 * (l1 - 1) / 2 * l2); tmp2 = Math.Max(tmp2, l3 * (l3 - 1) / 2 * l4); } ans = ans * tmp2; } else if(word[i]=='o') { long tmp = cnt[word[i]] / 2 * (cnt[word[i]] - cnt[word[i]] / 2); ans = ans * tmp; } else { ans = ans * (cnt[word[i]]); } } Console.WriteLine(ans); } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 0 0 0 1 1 0 0 1 0 0 0 4 0 0 3 0 0 1 0 0 0 0 1 0 0 0 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }