incLast [] = [] incLast (x:[]) = [x + 1] incLast (x:xs) = x : incLast xs main :: IO () main = do print $ last $ incLast [1..2999999]