A,B,C,D=map(int,input().split()) if A>B: n=C/A print(floor(n)) elif B>A: n=D/B print(floor(n)) else: if C>D: n=D/B print(floor(n)) elif D>C: n=C/A print(floor(n)) else: n=C/A print(floor(n))