typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll n,m,w; std::cin >> n>>m>>w; vector a(n),b(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } for (int i = 0; i < n; i++) { std::cin >> b[i]; } vector c(m),d(m); for (int i = 0; i < m; i++) { std::cin >> c[i]; } for (int i = 0; i < m; i++) { std::cin >> d[i]; } ll l = n+m; ll l2 = 1< dp(l2); // std::cout << l2 << std::endl; ll ans = 0; dp[0]=true; for (int i = 1; i < l2; i++) { ll sumc = 0; ll sumd = 0; for (int j = 0; j < l; j++) { if(!(i&(1<w)continue; for (int j = 0; j < l; j++) { if(i&(1<=0&&sumc-a[j]<=w){ dp[i] = true; } }else{ if(sumc+c[j-n]>=0&&sumc+c[j-n]<=w){ dp[i] = true; } } } } if(dp[i]){ ans = max(ans, sumd); } } std::cout << ans << std::endl; }