import Prelude import Data.Char (digitToInt) months :: [(Int, Int)] months = zip [1..] [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] main :: IO () main = print calc calc :: Int calc = sum $ map (\(m, md) -> length $ filter ((==) m . sumDigits) [1..md]) $ months sumDigits :: Int -> Int sumDigits d = sum $ map digitToInt $ show d