A snail is at the bottom of a 30 foot well. Every hour the snail is able to climb up 3 feet, then immediately slide back down 2 feet. How many hours does it take for the snail to get out of the well?
I know the answer. But I also like generalizing things. Is there a general formula for resolving this kind of puzzle? The formula must work in every single particular case of general distance, speed up, and speed down.