#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); long long n,m,w; cin >> n >> m >> w; vector<long long> a(n); vector<long long> b(m),c(m); for(auto &nx : a){cin >> nx;} for(auto &nx : b){cin >> nx;} for(auto &nx : c){cin >> nx;} sort(a.begin(),a.end()); reverse(a.begin(),a.end()); vector<long long> s={0}; for(auto &nx : a){ s.push_back(s.back()+nx); } long long res=0; for(long long i=0;i<(1ll<<m);i++){ long long cres=0,cw=0; for(long long j=0;j<m;j++){ if(i&(1ll<<j)){ cres+=c[j]; cw+=b[j]; } } cw = w - cw; if(cw>=0){ res=max(res,cres+s[min((long long)(s.size()-1),cw)]); } } cout << res << "\n"; return 0; }