A,B,C,D = [int(x) for x in input().split()] def calc(): x = D//(1+C) y = A z = B//C return min(x,y,z) print(calc())