#include using namespace std; #ifdef local #include #else #define debug(...) #endif #define rep(i, n) for (int i = 0; i < n; i++) template istream& operator>>(istream& I, vector& V) {for (T& X : V) I >> X; return I;} template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} vector di = {-1, 1, 0, 0}, dj = {0, 0, -1, 1}; int inf = 2e9; long INF = 1e18; int main() { int n, d, k; cin >> n >> d >> k; vector a(n), c(n); cin >> a >> c; vector dp(d + 1, vector(k + 1, -INF)); dp[0][0] = 0; rep(i, n) { auto p = dp; swap(p, dp); rep(j, d) rep(I, k + 1) { int nk = min(k, I + c[i]); chmax(dp[j + 1][nk], p[j][I] + a[i]); } } long ans = dp[d][k]; if (ans < -1e10) { cout << "No\n"; } else { cout << ans << endl; } return 0; }