from math import ceil d = int(input()) H = [int(input()) for _ in range(3)] if (H[0] < H[1] and H[1] > H[2]) or (H[0] > H[1] and H[1] < H[2]): print(0) elif (H[1] == 0 and (H[0] == 0 or H[2] == 0)) or d == 0: print(-1) else: ans = ceil(max(0, H[0]-H[1]) / d) + (H[0]-H[1] - ceil(max(0, H[0]-H[1]) / d) * d == 0) + ceil(max(0, H[2]-H[1]) / d) + (H[2]-H[1] - ceil(max(0, H[2]-H[1]) / d) * d == 0) if H[0] != 0 and H[2] != 0: ans = min(ans, ceil((H[1] - min(H[0], H[2])) / d) + (H[1] - min(H[0], H[2]) - ceil((H[1] - min(H[0], H[2])) / d) * d == 0)) print(ans)