n=list(map(int,input().split())) a=n[1]//n[2] b=n[3]//(n[2]+1) m=n[0] if(m>a): m=a if(m>b): m=b print(m)