#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]; vll dp(1ll << m); vll dpw(1ll << m); rep(i,1ll< w) continue; if(w - dpw[i] >= 0 && w - dpw[i] < n) chmax(ans, dp[i] + s[w - dpw[i]]); else if(w - dpw[i] >= n) chmax(ans, dp[i] + s[n]); else chmax(ans, dp[i]); } cout << ans << endl; }