d = int(input()) h = [0] * 3 h[0] = int(input()) h[1] = int(input()) h[2] = int(input()) if d == 0: if h[0] > h[1] and h[2] > h[1] : if h[0] != h[2]: ans = 0 elif h[0] < h[1] and h[2] < h[1]: if h[0] != h[2]: ans = 0 else: ans = -1 print(ans) exit() if h[0] > h[1] and h[2] > h[1] : if h[0] != h[2]: ans = 0 elif (h[0] - h[1]) > d: ans = 1 elif h[0] - h[1] == d: if 2 * d == h[0]: ans = -1 else: ans = 5 else: if h[0] == d: ans = -1 else: ans = 3 print(ans) exit() elif h[0] < h[1] and h[2] < h[1]: if h[0] != h[2]: ans = 0 elif h[0] == 0 and h[2] == 0: ans = -1 else: ans = 1 print(ans) exit() if h[2] >= h[0]: tmp = h[0] h[0] = h[2] h[2] = tmp if min(h) == max(h): if min(h) <= d: ans = -1 else: ans = 3 print(ans) exit() if h[2] == 0: ans = (h[0]-h[1]) // d + 1 if h[0] == ans * d: ans = -1 print(ans) exit() if (h[0] - h[1]) == (h[1] - h[2]): ans = (h[0]-h[1]) // d + 1 if h[0] == 2 * d: ans = -1 print(ans) exit() if (h[0] - h[1]) > (h[1] - h[2]): ans = (h[1]-h[2]) // d + 1 #if (h[1]-h[2]) % d == 0: # ans -= 1 print(ans) exit() else: ans = (h[0]-h[1]) // d + 1 if h[0] == 2 * d: ans = -1 print(ans) exit()