a, b, c, d = [int(x) for x in input().split()] ans = 0 while c >= a and d >= b: c -= a d -= b ans += 1 print(ans)