— Well. You solved it all on your own?

— They solved it wrong, if I correctly understand the problem

— It's not working well for all numbers

— You forgot the depth of the well

— Ah wait. That's the stdin

— Hmm. You could solve this with a recursive function

— But that really looks like an assignment designed to be for your level