l n = sum $ filter (\x -> x > 30 && x `mod` 5 == 0) $ take n [1..] main = print $ l 40