from bisect import bisect_right n, m, k = map(int, input().split()) A = list(map(int, input().split())) A.sort() A = [0] + A k1 = k // 2 B1 = set([0]) for _ in range(k1): NB1 = set() for b in B1: for a in A: NB1.add(b + a) B1 = NB1 k2 = k - k1 B2 = set([0]) for _ in range(k2): NB2 = set() for b in B2: for a in A: NB2.add(b + a) B2 = NB2 B1 = sorted(B1) B2 = sorted(B2) nn = len(B1) ans = 0 for i in range(nn): res = m - B1[i] if res < 0: break idx = bisect_right(B2, res) ans = max(ans, B1[i] + B2[idx - 1]) print(ans)