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