n,m,k = map(int,input().split()) A = list(map(int,input().split())) l = k//2 r = k-l dp = [0] def get(l): temp = set([0]) for i in range(l): ntemp = set() for x in temp: ntemp.add(x) for a in A: if a+x <= m: ntemp.add(a+x) temp = ntemp return sorted(temp) llist = get(l) rlist = get(r) ans = 0 r = len(rlist)-1 for x in llist: while r >= 0 and rlist[r]+x > m: r -= 1 if r != -1: ans = max(ans,x+rlist[r]) print(ans)