a,b,c,d = map(int,input().split()) print(a if a*c <= b and a*(c+1) <=d else min(a,b//c) if a*(c+1) <= d else min(a,d//(c+1)))