There are N walls, a man can jump up A meters, but he slide down B meters after 1 jump. How many jumps are needed in total to jump out all N walls? For example, you have 1 wall, the wall is 10 meters, the man can jump 10 meters in one shot, but slide down 3 meters per jump. Then he will need 1 jump to jump over that 10 meters wall; if we have a wall of 18 meters, the man need 3 jumps, because he slides down 3 meters after the first jump, and the second jump can jump to 17 meters at most, and thus 3 jumps are required.
There will be at most 10^4 walls, each wall can be very tall.