A,B,C,D = map(int, input().split()) P,Q,R,S,T = map(int, input().split()) L = {P: A, Q: B, R: C, S: D} qt = dict(sorted(L.items())) toutle = 0 def TAndQ(qt,T): first_key, first_value = next(iter(qt.items())) if first_key * first_value <= T: toutle = toutle + first_value T = T - first_key * first_value del qt[first_key] return TAndQ(qt,T) elif first_key * first_value > T: toutle = toutle + T // first_key return toutle else: return toutle print(toutle)