#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n,m,k; cin>>n>>m>>k; vector A(n); rep(i,n) cin>>A[i]; vector A2; rep(i,n) rep(j,n) A2.push_back(A[i]+A[j]); vector A3; rep(i,n) rep(j,n*n) A3.push_back(A[i]+A2[j]); sort(ALL(A)),sort(ALL(A2)),sort(ALL(A3)); ll ans=0; auto a=upper_bound(ALL(A),m)-A.begin(); if(a){ a--; ans=A[a]; } if(k>1){ auto a2=upper_bound(ALL(A2),m)-A2.begin(); if(a2){ a2--; ans=max(ans,A2[a2]); } } if(k>2){ auto a3=upper_bound(ALL(A3),m)-A3.begin(); if(a3){ a3--; ans=max(ans,A3[a3]); } } if(k>3){ rep(i,n*n){ auto a4=upper_bound(ALL(A2),m-A2[i])-A2.begin(); if(a4){ a4--; ans=max(ans,A2[i]+A2[a4]); } } } if(k>4){ rep(i,n*n*n){ auto a5=upper_bound(ALL(A2),m-A3[i])-A2.begin(); if(a5){ a5--; ans=max(ans,A3[i]+A2[a5]); } } } if(k>5){ rep(i,n*n*n){ auto a6=upper_bound(ALL(A3),m-A3[i])-A3.begin(); if(a6){ a6--; ans=max(ans,A3[i]+A3[a6]); } } } cout<