#include using namespace std; using i64 = long long; #define yn(pope) (pope ? "Yes" : "No") #define rep(i, n, m) for (int i = (n); i < (m); i++) #define rrep(i, n, m) for (int i = (n); i > m; i--) #define IINF (1 << 30) #define INF (1ll << 60) #define all(v) v.begin(), v.end() int main() { int N, M; i64 W; cin >> N >> M >> W; vector A(N), B(M), C(M); for (i64 &x : A) { cin >> x; } for (i64 &x : B) { cin >> x; } for (i64 &x : C) { cin >> x; } sort(all(A)); reverse(all(A)); vector sum(N + 1); rep(i, 1, N + 1) { sum[i] = sum[i - 1] + A[i - 1]; } i64 ans = 0; rep(i, 0, (1 << M)) { i64 w = 0; i64 v = 0; rep(j, 0, M) { w += B[j] * ((i >> j) & 1); v += C[j] * ((i >> j) & 1); } v += sum[max(0ll, min((i64)N, W - w))]; if (w <= W) { ans = max(ans, v); } } cout << ans << endl; return 0; }