choice3 :: [Int] -> [Int] choice3 [] = [] choice3 (x:xs) | x `mod` 3 == 0 = x : choice3 xs | choice3' x == True = x : choice3 xs | otherwise = choice3 xs where choice3' :: Int -> Bool choice3' i = let i_10 = floor $ (fromIntegral (i)) / 10 i_01 = i - i_10 * 10 in i_01 == 3 || choice3' i_10 intListShowRow [] = putStrLn "" intListShowRow (x:xs) = do print x intListShowRow xs main = do str <- getLine let w = words str a = read (w !! 0) b = read (w !! 1) intListShowRow $ choice3 [a..b]