#include #define INF 1000000001LL #define LNF 1000000000000000001LL #define MOD 998244353LL #define MAX 1005 #define long long long #define all(x) x.begin(),x.end() using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long n,m,w; cin >> n >> m >> w; vector a(n); vector b(n); vector c(n); vector hap(n+1); for(int i = 0; i> a[i]; for(int i = 0; i> b[i]; for(int i = 0; i> c[i]; sort(all(a)); reverse(all(a)); for(int i = 0; i w) continue; curV+=hap[min(n,w-curW)]; res = max(res,curV); } cout << res << endl; return 0; }