#include using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { vector a(4), b(4); rep(i, 4) cin >> a[i]; rep(i, 4) cin >> b[i]; ll t; cin >> t; using P = pair; vector

p(4); rep(i, 4) p[i] = P(b[i], a[i]); sort(p.begin(), p.end()); ll ans = 0; rep(i, 4) { if(p[i].first * p[i].second > t) { ans += t / p[i].first; break; } else { ans += p[i].second; t -= p[i].first * p[i].second; } } cout << ans << endl; }