#include<iostream>
#include<cassert>
using namespace std;
int N,M,W;
int A[7],B[7],C[7],D[7];
bool dp[1<<14];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M>>W;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	for(int i=0;i<M;i++)cin>>C[i];
	for(int i=0;i<M;i++)cin>>D[i];
	dp[0]=true;
	int ans=0;
	for(int i=0;i<1<<N+M;i++)if(dp[i])
	{
		int w=0,v=0;
		for(int j=0;j<N+M;j++)if(i>>j&1)
		{
			if(j<N)w+=A[j],v+=B[j];
			else w-=C[j-N],v-=D[j-N];
		}
		ans=max(ans,v);
		for(int j=0;j<N+M;j++)if(!(i>>j&1))
		{
			int nw=w;
			if(j<N)nw+=A[j];
			else nw-=C[j-N];
			if(0<=nw&&nw<=W)dp[i|1<<j]=true;
		}
	}
	cout<<ans<<endl;
}