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