A, B, C, D = map(int, input().split()) total = 0 res = 0 while total + C + 1 < D and B >= C: res += 1 total += 1 + C A -= 1 B -= C print(res)