n,m,k=map(int,input().split()) a=list(map(int,input().split())) k1=k//2 k2=k-k1 def get(s): if s==0: return [0] res=get(s-1) new=set(res) for i in range(n): for j in res: if a[i]+j<=m: new.add(a[i]+j) return list(new) res1=get(k1) res2=get(k2) res1.sort() res2.sort() ans=0 idx=len(res2)-1 for i in res1: while i+res2[idx]>m: idx-=1 ans=max(ans,i+res2[idx]) print(ans)