#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, d, k; cin >> n >> d >> k; vector> a(n); for(int i = 0; i < n; i++) cin >> a[i].first; for(int i = 0; i < n; i++) cin >> a[i].second; vector> dp(d + 1, vector(k + 1, -(1ll << 62))); dp[0][0] = 0; int cur = 0; for(auto [v, v2] : a){ for(int i = min(cur, d - 1); i >= 0; i--){ for(int j = k; j >= 0; j--){ int nj = min(k, j + v2); dp[i + 1][nj] = max(dp[i + 1][nj], dp[i][j] + v); } } cur++; } ll ans = dp[d][k]; if(ans < -(1ll << 30) * n){ cout << "No\n"; return 0; } cout << ans << '\n'; }