#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using vll = vector; using vvll = vector>; using P = pair; using vp = vector>; #define mod 998244353 #define all(v) v.begin(), v.end() #define resort(v) sort(v.rbegin(), v.rend()) #define rep(i, n) for (ll i = 0; i < n; ++i) #define per(i, n) for (ll i = n - 1; i >= 0; --i) #define rep2(i, a, n) for (ll i = a; i < n; ++i) #define per2(i, a, n) for (ll i = n - 1; i >= a; --i) #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) const ll inf = 1ll << 60; ll dx[] = {1,0,0,-1,1,-1,1,-1}; ll dy[] = {0,1,-1,0,1,1,-1,-1}; int main() { ll n, m, w, ans = 0; cin >> n >> m >> w; vll a(n), b(m), c(m), s(n + 1); rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; rep(i, m) cin >> c[i]; resort(a); s[0] = 0; rep(i, n) s[i + 1] = s[i] + a[i]; vvll dp(m + 1, vll(1ll << m)); vvll dpw(m + 1, vll(1ll << m)); rep(i, m){ rep(j, (1ll << m)){ chmax(dp[i + 1][j], dp[i][j]); if(dpw[i][j] + b[i] <= w) chmax(dp[i + 1][j | (1ll << i)], dp[i][j] + c[i]); dpw[i + 1][j] = dpw[i][j]; dpw[i + 1][j | (1ll << i)] = dpw[i][j] + b[i]; } } ans = s[n]; rep(i, (1ll << m)){ //cout << dpw[m][i] << endl; //cout << "i: " << i << endl; // デバッグ情報: i の値を出力 if(dpw[m][i] > w) continue; if(w - dpw[m][i] >= 0 && w - dpw[m][i] < n) chmax(ans, dp[m][i] + s[w - dpw[m][i]]); else if(w - dpw[m][i] >= n) chmax(ans, dp[m][i] + s[n]); else chmax(ans, dp[m][i]); } cout << ans << endl; }