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