import Control.Applicative import Control.Monad takeWhileM _ [] = return [] takeWhileM p (mx:mxs) = mx >>= \x -> if p x then (x:) <$> takeWhileM p mxs else return [] yoba = do let chislo2 = 0 takeWhileM (/= 0) (repeat readLn) >>= foldM (\chislo2 i -> (>>) <$> print <*> return $ chislo2 + i * 100^500) chislo2 main = yoba >>= print >> getContents >>= mapM_ putStrLn . lines