f :: [Int] -> Int f xs = let t = sum xs n = t `div` 10 in length (filter (n >=) xs) * 30 main = getLine >> getLine >>= print . f . map read . words