a, b, c, d = map(int, input().split(' ')) x = 1 while True: if x > a: break if (x * c) > b: break if x * (c + 1) > d: break x += 1 print(x - 1)