#include #include using namespace std; using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); 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; } long long N,D,K; vector A,C; vector>> memory; const long long INF = 1LL << 60; long long dp(long long n,long long k,long long d){ long long& ret = memory[n][k][d]; if(ret != -1)return ret; ret = -INF; if(n == 0){ if(k == 0 && d == 0)ret = 0; return ret; } if(d == 0){ if(k == 0)ret = 0; return ret; } chmax(ret,dp(n-1,k,d)); chmax(ret,dp(n-1,max(0LL,k-C[n-1]),d-1) + A[n-1]); return ret; } int main() { cin >> N >> D >> K; rep(i,N){ long long a; cin >> a; A.push_back(a); } rep(i,N){ long long a; cin >> a; C.push_back(a); } memory.resize(501,vector>(501,vector(501,-1))); if(dp(N,K,D) > -1e12)cout << dp(N,K,D) << endl; else cout << "No" << endl; }