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) + ceil(max(0, H[2] - H[1]) / d) if H[0] >= H[1] and (H[0] - H[1]) % d == 0: ans += 1 if H[2] >= H[1] and (H[2] - H[1]) % d == 0: ans += 1 if H[0] != 0 and H[2] != 0: cand = ceil((H[1] - min(H[0], H[2])) / d) if (H[1] - min(H[0], H[2])) % d == 0: cand += 1 ans = min(ans, cand) print(ans)