Snail: a snail climbs up a glass of drink. He moves up a distance X
then slides back half X. How many times does the snail climb up
and what is the total distance distance travelled upwards?

In my example the snail climbs up one fifth of the glass height each time.
What happens if the climb distance was to be different?