#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; constexpr long long INF = 1002003004005006007; ll dp[510][510]; } int main() { ios::sync_with_stdio(false); cin.tie(0); rep(i, 510) rep(j, 510) dp[i][j] = -INF; dp[0][0] = 0; int n, d, k; cin >> n >> d >> k; VI a(n), c(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> c[i]; rep(i, n) { int ci = min(c[i], k); int add = a[i]; rrep(i, 509) rrep(j, 510) if (dp[i][j] != -INF) { chmax(dp[i+1][min(j+ci, k)], dp[i][j] + add); } } ll ans = dp[d][k]; if (ans == -INF) { cout << "No\n"; } else { cout << ans << '\n'; } }