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