#include using namespace std; using ll = long long; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); vector> P(4); for(int i = 0; i < 4; i++) cin >> P[i].second; for(int i = 0; i < 4; i++) cin >> P[i].first; ll T; cin >> T; ll ans = 0; sort(P.begin(), P.end()); for(int i = 0; i < 4; i++) { auto [t, n] = P[i]; ll x = min(n, T/t); T -= x * t; ans += x; } cout << ans << endl; }