#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=998244353; int main(){ int N,M,K; cin>>N>>M>>K; vector A(N); for(int i=0;i>A[i]; } A.push_back(0); vector tmp; auto dfs=[&](auto f,int idx, int n)->set{ if(idx==n){ return set{0}; } set tmp=f(f,idx+1,n); set tmpst; //被りがでないように for(ll v:tmp){ for(ll a:A){ if(v+a>M) continue; tmpst.insert(v+a); } } set res; for(ll v:tmpst){ //res.push_back(v); res.insert(v); } return res; }; set res1=dfs(dfs,0,K/2); set res2=dfs(dfs,0,K-K/2); ll ans=0; for(ll v1:res1){ for(ll v2:res2){ if(v1+v2>M) continue; ans=max(ans,v1+v2); } } cout<