a, b, c, d = map(int, input().split()) for x in range(1, a+1): y = x * c if y > b: print(x-1) break if x + y > d: print(x-1) break else: print(x)