import Data.Char main = do alphabet <- getContents >>= return . map (read::String->Int) . lines let num_h = alphabet!!(ord 'h' - ord 'a') let num_e = alphabet!!(ord 'e' - ord 'a') let num_l = alphabet!!(ord 'l' - ord 'a') let num_o = alphabet!!(ord 'o' - ord 'a') let num_w = alphabet!!(ord 'w' - ord 'a') let num_r = alphabet!!(ord 'r' - ord 'a') let num_d = alphabet!!(ord 'd' - ord 'a') print $ num_h * num_e * num_w * num_r * num_d * (num_o - (num_o`div`2))*(num_o`div`2) * maximum[ x*(num_l-x)*(num_l-x-1)`div`2 | x<-[1..num_l] ]