import bisect N,M,K = map(int,input().split()) A = list(map(int,input().split())) A.append(0) x = K//2 y = K-x old = A[:] for i in range(x-1): new = set() for i in range(len(old)): for j in range(len(old)): new.add(old[i]+old[j]) old = list(new) one = old old = A[:] for i in range(y-1): new = set() for i in range(len(old)): for j in range(len(old)): new.add(old[i]+old[j]) old = list(new) two = old one.sort() two.sort() ans = 0 for i in one: if M-i >= 0: index = bisect.bisect_right(two,M-i)-1 if index != len(two): if two[index] + i <= M: ans = max(ans,two[index] + i) print(ans)