import math d = int(input()) H = [] H.append(int(input())) H.append(int(input())) H.append(int(input())) if H[1] == 0 and (H[0] == H[1] or H[1] == H[2]): print(-1) exit() if H[0] == H[2] and H[0] == 0: print(-1) exit() if (H[1] == max(H) or H[1] == min(H)) and (H[0] != H[2]): print(0) exit() if d == 0: print(-1) exit() cnt = 0 if H[0] == H[2]: H[2] = max(H[2]-d, 0) cnt += 1 if H[0] < H[2]: H[0], H[2] = H[2], H[0] diff = 0 tar = 0 if H[2] == 0: diff = H[0] - H[1] tar = 0 else: diff = min(H[0] - H[1], H[1] - H[2]) if H[0] - H[1] < H[1] - H[2]: tar = 0 else: tar = 1 cnt += int(math.ceil((diff+0.5)/d)) H[tar] = max(H[tar] - d*cnt, 0) if H[0] == H[1] or H[1] == H[2] or H[0] == H[2]: print(-1) else: print(cnt)