a, b, c, d = map(int, input().split()) if b < c: print(0) exit() vegi_num = 0 for i in range(1, a + 1): meet_required = i * c if i + meet_required > d: break if b >= meet_required: vegi_num = i else: continue print(vegi_num)