Time = distance/speed, speed = distance/time.
Snails here crawl 7 feet during the day and spend half a day crawling, which means that the speed of crawling during the day is 7/0.5.
And the speed at night is -2/0.5.
The last formula is that the distance is 5 (the remaining distance that has not been climbed), the speed is 7/0.5, and the substitution formula is time.