a,b,c,d = list(map(int,input().split())) n = 0 for i in range(1,100): if i<=a and i*c<=b and i+i*c<=d: n = i else: break print(n)