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

CA = [list(map(int, input().split())) for _ in range(N)]



ans = 10 ** 18

for i in range(2 ** N):

    cost = 0

    each_alg = [0 for _ in range(M)]

    for j in range(N):

        if (i >> j) & 1:

            cost += CA[j][0]

            for k in range(M):

                each_alg[k] += CA[j][k+1]

    if min(each_alg) >= X:

        ans = min(ans, cost)



if ans == 10**18:

    print('-1')

else:

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

cost = []

A = []

for _ in range(N):

    ca = list(map(int, input().split()))

    cost.append(ca[0])

    A.append(ca[1:])



ans = 10**9

for bit in range(2**N):

    alg = [0]*M

    c = 0

    for i in range(N):

        if bit >> i & 1 == 1:

            for j in range(M):

                alg[j] += A[i][j]

            c += cost[i]

    if min(alg) >= X:

        ans = min(ans, c)



if ans == 10**9:

    print((-1))

else:

    print(ans)
N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for _ in range(N)]
ans = 10**18
for i in range(2**N):
    cost = 0
    each_alg = [0 for _ in range(M)]
    for j in range(N):
        if (i >> j) & 1:
            cost += CA[j][0]
            for k in range(M):
                each_alg[k] += CA[j][k + 1]
    if min(each_alg) >= X:
        ans = min(ans, cost)
if ans == 10**18:
    print("-1")
else:
    print(ans)

N, M, X = list(map(int, input().split()))
cost = []
A = []
for _ in range(N):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    A.append(ca[1:])
ans = 10**9
for bit in range(2**N):
    alg = [0] * M
    c = 0
    for i in range(N):
        if bit >> i & 1 == 1:
            for j in range(M):
                alg[j] += A[i][j]
            c += cost[i]
    if min(alg) >= X:
        ans = min(ans, c)
if ans == 10**9:
    print((-1))
else:
    print(ans)

-CA = [list(map(int, input().split())) for _ in range(N)] -ans = 10**18 -for i in range(2**N): -    cost = 0 -    each_alg = [0 for _ in range(M)] -    for j in range(N): -        if (i >> j) & 1: -            cost += CA[j][0] -            for k in range(M): -                each_alg[k] += CA[j][k + 1] -    if min(each_alg) >= X: -        ans = min(ans, cost) -if ans == 10**18: -    print("-1") +cost = [] +A = [] +for _ in range(N): +    ca = list(map(int, input().split())) +    cost.append(ca[0]) +    A.append(ca[1:]) +ans = 10**9 +for bit in range(2**N): +    alg = [0] * M +    c = 0 +    for i in range(N): +        if bit >> i & 1 == 1: +            for j in range(M): +                alg[j] += A[i][j] +            c += cost[i] +    if min(alg) >= X: +        ans = min(ans, c) +if ans == 10**9: +    print((-1))