SP9655 ELEVTRBL - Elevator Trouble

Description

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 _s_, where you see an elevator. Upon entering the elvator, you learn that it has only two buttons, marked "UP _u_" and "DOWN _d_". You conclude that the UP-button takes the elevator _u_ floors up (if there aren't enough floors, pressing the UP-botton does nothing, or at least so you assume), whereas the DOWN-button takes you _d_ stories down (or none if there aren't enough). Knowing that the interview is at floor _g_, and that there are only _f_ 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 input _f_, _s_, _g_, _u_ and _d_ (floors, start, goal, up, down), find the shortest sequence of button presses you must press in order to get from _s_ to _g_, given a building of floors, or output "use the stairs" if you cannot get from _s_ to _g_ by the given elevator.

Input Format

The input will consist of one line, namely f s g u d, where 1

Output Format

You must reply with the minimum numbers of pushes you must make in order to get from s to g, or output "use the stairs" if it is impossible given the conguration of the elevator.