A,B,C,D = map(int,input().split()) K = 100000 if A != 0: K = C // A E = 100000 if B != 0: E = D // B print(min(K,E))