A, B, C, D = map(int, input().split()) count = 0 for i in range(D): A -= 1 B -= C count += 1 D = 1 + C if A == 0 or B < C: break print(count)