// Arup Guha
// 6/16/2026
// Solution to Kattis Problem Elevator Trouble, to illustrate BFS
// https://open.kattis.com/problems/elevatortrouble

using namespace std;
#include <bits/stdc++.h>

int main() {

    // Get the input.
    int numFloors, start, end, up, down;
    cin >> numFloors >> start >> end >> up >> down;

    // Set up initial distances and put start in the queue.
    vector<int> dist(numFloors+1, -1);
    dist[start] = 0;
    queue<int> q;
    q.push(start);

    // Run BFS.
    while (q.size() > 0) {

        // Get the item at front and get rid of it.
        int curF = q.front(); q.pop();

        // Where I can go to next.
        vector<int> next = {curF+up,curF-down};

        // Try both new floors.
        for (int i=0; i<next.size(); i++) {

            // Valid floor I haven't been to.
            if (next[i] <= numFloors && next[i] >= 1 && dist[next[i]] == -1) {
                dist[next[i]] = dist[curF] + 1;
                q.push(next[i]);
            }
        }
    } // end bfs

    // This is what they want.
    if (dist[end] == -1)
        cout << "use the stairs" << endl;
    else
        cout << dist[end] << endl;

    return 0;
}
