r, p, q = map(int, input().split()) a, b, c, d = map(int, input().split()) L = 0 R = 1 def check(x): rem = d todo = 0 if a < x: todo += x - a else: rem += a - x if b < x: todo += x - b else: rem += b - x if c < x: todo += x - c else: rem += c - x if todo > rem: return False cost = todo * q + x * p return cost <= r while check(R): L = R R *= 2 while R - L > 1: mid = (L + R) // 2 if check(mid): L = mid else: R = mid print(L)