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