a, b, c, d = map(int, input().split()) print(min(c // a if a else 1000, d // b if b else 1000))