N,M,K = map(int,input().split()) A = list(map(int,input().split())) + [0] S = [set() for _ in range(7)] S[0] = {0} S[1] = set(A) for i in range(2,4): for a in S[1]: for b in S[i-1]: d = a + b if d <= M: S[i].add(d) if K < 4: print(max(S[K])) exit() i = K // 2 j = K - i S1 = list(S[i]) S1.sort() S2 = list(S[j]) S2.sort(reverse = True) NS2 = len(S2) i = 0 ans = 0 for a in S1: while i < NS2 and a + S2[i] > M: i += 1 ans = max(ans,a + S2[i]) if i == NS2: break print(ans)