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