#include using namespace std; using ll=long long; int main(){ ll n,m,w; cin>>n>>m>>w; vector a(n),b(n),c(m),d(m); for(ll i=0;i>a[i]; } for(ll i=0;i>b[i]; } for(ll i=0;i>c[i]; } for(ll i=0;i>d[i]; } ll dp[1<<(n+m)][w+1]; for(ll i=0;i<(1<<(n+m));i++){ for(ll j=0;j<=w;j++){ dp[i][j]=0; } } for(ll s=0;s<(1<<(n+m));s++){ for(ll i=0;i<=w;i++){ for(ll j=0;j=0){ dp[s|(1<<(n+j))][i-c[j]]=max(dp[s|(1<<(n+j))][i-c[j]],dp[s][i]-d[j]); } } } } } ll ans=0; for(ll i=0;i<=w;i++){ ans=max(dp[1<<(n+m)-1][i],ans); } cout<