A, B, C, D = map(int, input().split()) n = min(A, B//C, D//(1+C)) print(n)