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 = sorted(L) toutle = 0 def TAndQ(qt,T,toutle): if not qt: return toutle first_key, first_value = qt[0] if first_key * first_value <= T: toutle = toutle + first_value T = T - first_key * first_value qt.pop(0) return TAndQ(qt,T,toutle) else : toutle = toutle + T // first_key return toutle toutle = TAndQ(qt, T, toutle) print(toutle)