A, B, C, D = map(int, input().split()) ans = 0 for a in range(1, A+1): if B >= C*a and (C+1)*a <= D: ans = a else: break print(ans)