Yasai,Niku,C,D=[int(i) for i in input().split()] vegimax=0 for i in range(Yasai): if i*C<=Niku and i*(C+1)<=D: vegimax=i print(vegimax)