from collections import deque#f=총 층, g=스타트링크의 층, s=내가있는층, u=u층위로, d=d층아래로
f,s,g,u,d=map(int,input().split())arr=[-1 for _ in range(f+1)]que=deque([s])
arr[s]=0if s==g: print(0) exit()while que: now=que.popleft()
for next in (now+u,now-d): if 0<next<=f and arr[next]==-1:
arr[next]=arr[now]+1 que.append(next)
if next==g: print(arr[next]) exit()
print("use the stairs")https://www.acmicpc.net/problem/5014
5014번: 스타트링크첫째 줄에 F, S, G, U, D가 주어진다. (1 ≤ S, G ≤ F ≤ 1000000, 0 ≤ U, D ≤ 1000000) 건물은 1층부터 시작하고, 가장 높은 층은 F층이다.www.acmicpc.net
간단한 dfs문제
처음에 틀렸는데, 내가있는층==가고싶은층일때를 제외했기 때문
설명 x