N, M, X = map(int, input().split())

A = []
for i in range(N):
    a = []
    for m in map(int, input().split()):
        a.append(m)
    A.append(a)

min_cost = float("INF")

for a in [0, 1]:
    for b in [0, 1]:
        for c in [0, 1]:
            for d in [0, 1]:
                for e in [0, 1]:

                    for f in [0, 1]:
                        for g in [0, 1]:
                            for h in [0, 1]:
                                for i in [0, 1]:
                                    for j in [0, 1]:

                                        for k in [0, 1]:
                                            for l in [0, 1]:

                                                x = {}
                                                for m in range(1, M + 1):
                                                    x[m] = 0
                                                cost = 0
                                                if a == 1 and len(A) >= 1:
                                                    cost += A[0][0]
                                                    for m in range(1, M+1):
                                                        x[m] += A[0][m]
                                                if b == 1 and len(A) >= 2:
                                                    cost += A[1][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[1][m]
                                                if c == 1 and len(A) >= 3:
                                                    cost += A[2][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[2][m]
                                                if d == 1 and len(A) >= 4:
                                                    cost += A[3][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[3][m]
                                                if e == 1 and len(A) >= 5:
                                                    cost += A[4][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[4][m]

                                                if f == 1 and len(A) >= 6:
                                                    cost += A[5][0]
                                                    for m in range(1, M+1):
                                                        x[m] += A[5][m]
                                                if g == 1 and len(A) >= 7:
                                                    cost += A[6][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[6][m]
                                                if h == 1 and len(A) >= 8:
                                                    cost += A[7][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[7][m]
                                                if i == 1 and len(A) >= 9:
                                                    cost += A[8][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[8][m]
                                                if j == 1 and len(A) >= 10:
                                                    cost += A[9][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[9][m]

                                                if k == 1 and len(A) >= 11:
                                                    cost += A[10][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[10][m]
                                                if l == 1 and len(A) >= 12:
                                                    cost += A[11][0]
                                                    for m in range(1, M + 1):
                                                        x[m] += A[11][m]

                                                success = True
                                                for m in range(1, M + 1):
                                                    if x[m] < X:
                                                        success = False
                                                        break

                                                if success:
                                                    if cost < min_cost:
                                                        min_cost = cost

if min_cost == float("INF"):
    print(-1)
else:
    print(min_cost)



Measured memory_bytes: 9360