#include using namespace std; //*/ #include using namespace atcoder; //*/ #define rep(i,n) for(int i=0;i; using ll = long long; using ull = unsigned long long; //*/ template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef pair pii; typedef pair pll; typedef vector vll; typedef vector vint; random_device rnd; mt19937 rng(rnd()); void solve(){ int n,m; ll w,ans = 0; cin >> n >> m >> w; vll a(n); rep(i,n) cin >>a[i]; sort(ALL(a)); reverse(ALL(a)); vll b(m),c(m); rep(i,m) cin >> b[i]; rep(i,m) cin >> c[i]; vll s(n+1,0); rep(i,n) s[i+1] = s[i]+a[i]; int m2 = 1<>i&1) bs+=b[i],cs+=c[i]; if(w-bs >= 0)chmax(ans,s[min((int)(w-bs),n)]+cs); } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; rep(dirc,t) solve(); }