a,b,c,d = map(int,input().split()) if a != 0: u = c // a else: u = 1000000 if b != 0: v = d // b else: v = 1000000 print(min(u,v))