R,P,Q = map(int, input().split()) A,B,C,D = map(int, input().split()) ok = 0 ng = 100000000000 while ng-ok > 1: mid = (ok+ng)//2 a,b,c,d = A,B,C,D cost = mid*P insufficient = 0 insufficient += max(0, mid-a) + max(0, mid-b) + max(0, mid-c) over = 0 over += max(0, a-mid) + max(0, b-mid) + max(0, c-mid) + d if insufficient > over: ng = mid continue cost += insufficient*Q if cost <= R: ok = mid else: ng = mid print(ok)