a, b, c, d = map(int, input().split()) print(min(min(a, b // c), d // (1 + c)))