A,B,C,D = list(map(int,input().split())) ans = 0 for i in range(A+1): if i * C <= B and i + (i * C) <= D: ans = i print(ans)