a,b,c,d = io.read("*n","*n","*n","*n") min = math.min(a, math.floor(b / c)) min = math.min(min, math.floor(d / (c+1))) io.write(min)