#include using namespace std; using ll = long long; using ull = unsigned long long; using Matrix = vector>; const int inf = 1000000000; const ll INF = 1000000000000000000; const ll mod = 998244353; const ull mod_hash = (1UL << 61) - 1; const vector dx = {0, 1, 0, -1, 1, 1, -1, -1}; const vector dy = {1, 0, -1, 0, 1, -1, 1, -1}; template struct CumulativeSum { vector S; CumulativeSum(vector A) { int N = A.size(); S.assign(N + 1, 0); for (int i = 0; i < N; i++) S[i + 1] = S[i] + A[i]; } //sum of [l, r) (0-indexed) T sum(int l, int r) { return S[r] - S[l]; } }; int main(){ ll N, M, W;cin>>N>>M>>W; vector A(N), B(M), C(M); for (int i = 0; i < N; i++) cin>>A[i]; for (int i = 0; i < M; i++) cin>>B[i]; for (int i = 0; i < M; i++) cin>>C[i]; sort(A.begin(), A.end(), greater()); CumulativeSum S(A); ll ans = 0; for (int i = 0; i < (1<>j)&1){ w += B[j]; c += C[j]; } } if(w > W)continue; ans = max(ans, c + S.sum(0, min(N, W - w))); } cout << ans << endl; return 0; }