#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) using ll = long long int; int main() { int N, M; ll W; cin >> N >> M >> W; vector A(N), B(M), C(M); rep(i, N) cin >> A[i]; rep(i, M) cin >> B[i]; rep(i, M) cin >> C[i]; vector dp(W + 1, 0); rep(i, N) { vector newdp(W + 1, 0); rep(j, W + 1) { if (j >= 1) newdp[j] = max(dp[j - 1] + A[i], dp[j]); else newdp[j] = dp[j]; } dp = newdp; } rep(i, M) { vector newdp(W + 1, 0); rep(j, W + 1) { if (j >= B[i]) newdp[j] = max(dp[j - B[i]] + C[i], dp[j]); else newdp[j] = dp[j]; } dp = newdp; } cout << dp[W] << endl; return 0; }