You are on your way to your first job interview as a program tester, and you are already late. The interview is in a skyscraper and you are currently in floor , where you see an elevator. Upon entering the elevator, you learn that it has only two buttons, marked "UP " and "DOWN ". You conclude that the UP-button takes the elevator floors up (if there aren't enough floors, pressing the UP-button does nothing, or at least so you assume), whereas the DOWN-button takes you stories down (or none if there aren't enough). Knowing that the interview is at floor , and that there are only floors in the building, you quickly decide to write a program that gives you the amount of button pushes you need to perform. If you simply cannot reach the correct floor, your program halts with the message "use the stairs".
Given , , , and (floors, start, goal, up, down), find the shortest sequence of button presses to get from to , given a building of floors, or output "use the stairs" if you cannot get from to by the given elevator.
Consist of one line, namely , where 1 \leq s, g \leq f \leq 10^6 and 0 \leq u, d \leq 10^6. The floors are one-indexed, i.e. if there are stories, and will be in [, ].
You must reply with the minimum numbers of pushes you must make in order to get from to , or output "use the stairs" if it is impossible given the configuration of the elevator.
Example 1
Example 2