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