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

A = [[int(x) for x in input().split()] for _ in range(N)]



INF = float('inf')

ans = INF



for i in range(2**N):

    tmp = [0 for _ in range(M+1)]

    b = bin(i)[2:].zfill(N)

    

    for n in range(N):

        for m in range(M+1):

            tmp[m] += A[n][m] * int(b[N-1-n])



    if min(tmp[1:]) >= X:

        ans = min(ans, tmp[0])



if ans == INF:

    ans = -1

print(ans)
INF = float('inf')

import copy

 

def dfs(i, C):

    if i == N:

        if min(C[1:]) >= X:

            return C[0]

        else:

            return INF

    res = INF

    res = min(res, dfs(i+1, copy.copy(C)))

    for j in range(M+1):

        C[j] = C[j] + L[i][j]

    res = min(res, dfs(i+1, copy.copy(C)))

    return res



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

L = [[int(x) for x in input().split()] for _ in range(N)]



ans = dfs(0, [0 for _ in range(M+1)])

if ans == INF:

    ans = -1

print(ans)
N, M, X = list(map(int, input().split()))
A = [[int(x) for x in input().split()] for _ in range(N)]
INF = float("inf")
ans = INF
for i in range(2**N):
    tmp = [0 for _ in range(M + 1)]
    b = bin(i)[2:].zfill(N)
    for n in range(N):
        for m in range(M + 1):
            tmp[m] += A[n][m] * int(b[N - 1 - n])
    if min(tmp[1:]) >= X:
        ans = min(ans, tmp[0])
if ans == INF:
    ans = -1
print(ans)

INF = float("inf")
import copy


def dfs(i, C):
    if i == N:
        if min(C[1:]) >= X:
            return C[0]
        else:
            return INF
    res = INF
    res = min(res, dfs(i + 1, copy.copy(C)))
    for j in range(M + 1):
        C[j] = C[j] + L[i][j]
    res = min(res, dfs(i + 1, copy.copy(C)))
    return res


N, M, X = list(map(int, input().split()))
L = [[int(x) for x in input().split()] for _ in range(N)]
ans = dfs(0, [0 for _ in range(M + 1)])
if ans == INF:
    ans = -1
print(ans)

+INF = float("inf") +import copy + + +def dfs(i, C): +    if i == N: +        if min(C[1:]) >= X: +            return C[0] +        else: +            return INF +    res = INF +    res = min(res, dfs(i + 1, copy.copy(C))) +    for j in range(M + 1): +        C[j] = C[j] + L[i][j] +    res = min(res, dfs(i + 1, copy.copy(C))) +    return res + + -A = [[int(x) for x in input().split()] for _ in range(N)] -INF = float("inf") -ans = INF -for i in range(2**N): -    tmp = [0 for _ in range(M + 1)] -    b = bin(i)[2:].zfill(N) -    for n in range(N): -        for m in range(M + 1): -            tmp[m] += A[n][m] * int(b[N - 1 - n]) -    if min(tmp[1:]) >= X: -        ans = min(ans, tmp[0]) +L = [[int(x) for x in input().split()] for _ in range(N)] +ans = dfs(0, [0 for _ in range(M + 1)])