//TLE #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); auto dfs=[&](auto f,int idx, int n)->vector{ if(idx==n){ return vector{0}; } vector tmp=f(f,idx+1,n); set tmpst; //被りがでないように for(ll v:tmp){ for(ll a:A){ tmpst.insert(v); if(v+a<=M){ tmpst.insert(v+a); } } } vector res; for(ll v:tmpst){ res.push_back(v); //res.insert(v); } return res; }; vector res1=dfs(dfs,0,K/2); vector res2=dfs(dfs,0,K-K/2); ll ans=0; for(ll v:res1){ if(v+res2.back()<=M){ ans=max(ans,res2.back()+v); } } for(ll v:res2){ if(v+res1.back()<=M){ ans=max(ans,res1.back()+v); } } cout<