a=list(map(int,input().split()))+list(map(int,input().split())) t=a[-1] q=[(a[i+4],a[i]) for i in range(4)] q.sort() c=0 for g,h in q: if t//g<=h: t-=g*h c+=h else: t-=g*(t//g) c+=t//g print(c)