a, b, c, d = map(int, input().split()) count = 0 for i in range(a + 1): if i * c > b or i + i * c > d: break else: count = i print(count)