A = list(map(int, input().split())) B = list(map(int, input().split())) C = B[:4] t = B[-1] D = [] for k, v in zip(A,B): D.append([k, v]) sortedD = sorted(D, key=lambda x: x[1]) ans = 0 for k, v in sortedD: if t > k * v: t -= k * v ans += k else: ans += t // v break print(ans)