main :: IO () main = do input_line <- getLine let numberlist = map area input_line :: [Int] let ln2 = length input_line --先に背景を緑で塗るパターン let ans1 = ln2 + 2 + (sum numberlist) * 2 --先に数字を緑で塗るパターン let ans2 = ln2 * 2 + 1 + sum numberlist let ans = min ans1 ans2 putStrLn $ show ans return () area :: Char -> Int area a | a == '8' = 2 | a == '0' || a == '4' || a == '6' || a == '9' = 1 | otherwise = 0