#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; const ll INF=1e18; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,m,w; cin>>n>>m>>w; vector A(n+m),B(n+m); rep(i,n) cin>>A[i]; rep(i,n) cin>>B[i]; rep(i,m){ cin>>A[i+n]; A[i+n]=-A[i+n]; } rep(i,m){ cin>>B[i+n]; B[i+n]=-B[i+n]; } vector E(n+m); rep(i,n+m) E[i]=i; ll ma=-INF; do{ vector> dp(n+m+1,vector(w+1,-INF)); dp[0][0]=0; rep(i,n+m){ rep(j,w+1){ if(dp[i][j]==-INF) continue; dp[i+1][j]=max(dp[i+1][j],dp[i][j]); if(j+A[E[i]]>=0 && j+A[E[i]]<=w) dp[i+1][j+A[E[i]]]=max(dp[i+1][j+A[E[i]]],dp[i][j]+B[E[i]]); } } rep(j,w+1) ma=max(ma,dp[n+m][j]); }while(next_permutation(ALL(E))); cout<