a, b, c, d = map(int, input().split()) cnt = 0 while c >= a and d >= b: c -= a d -= b cnt += 1 print(cnt)