A,B,C,D=map(int,input().split()) a=[] for i in range(1,A+1): if i*C<=B and i*(1+C)<=D: a.append(i) print(max(a))