a,b,c,d=map(int,input().split()) n=b//a if n>a: print(a) else: while n>0: if n*c>d: n-=1 else: break print(n)