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