A,B,C,D =map(int,input().split()) if B/C >=A: ans = A elif B/C < A and B/C>=1: ans=B/C else: ans=0 print(int(ans))