import sys def input(): return sys.stdin.readline().rstrip() def ii(f=int): return f(input()) def mi(f=int): return map(f, input().split()) def li(f=int): return list(map(f, mi())) R, P, Q = mi() A,B,C,D = mi() def judge(x): ok = True ok &= A+B+C+D>=3*x nd = max(0,x-A)+max(0,x-B)+max(0,x-C) ok &= R >= nd * Q ok &= R-nd*Q>=P*x return ok ac = 0 wa = 10 ** 18 while wa - ac > 1: wj = (ac + wa) // 2 if judge(wj): ac = wj else: wa = wj print(ac)