#include using namespace std; int main() { 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; } sort(P.begin(), P.end()); unsigned long long T; cin >> T; unsigned long long ans = 0; for (int i = 0; i < 4; i++) { unsigned long long count = min(P[i].second, T / P[i].first); T -= count * P[i].first; ans += count; } cout << ans; }