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