import sys input=lambda: sys.stdin.readline().rstrip() a,b,c,d=map(int,input().split()) for i in range(a): if (i+1)*c<=b and (i+1)*(c+1)<=d: continue else: ans=i break else: ans=i+1 print(ans)