A, B, C, D = [int(i) for i in input().split()] print(min(int(D/(1+C)), int(B/C), A))