a,b,c,d = map(int,input().split()) if c+1 > d: print(0) exit() for i in range(a): if d >= c+1: d -= c+1 else: print(i) exit() if b >= c: b -= c else: print(i) exit() print(a)