a,b,c,d=list(map(int,input().split())) print(min([a,int(b/c),int(d/(c+1))]))