import sys





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

A = [None] * N

C = [None] * N

for i, s in enumerate(sys.stdin.readlines()):

    C[i], *A[i] = list(map(int, s.split()))



ans = 10 ** 8

for i in range(1 << N):

    k = 0

    v = 0

    S = [0] * M

    while (i >> k) > 0:

        if (i >> k) & 1:

            for j in range(M):

                S[j] += A[k][j]

            v += C[k]

        k += 1



    if all(a >= X for a in S):

        ans = min(ans, v)

        



if ans < 10 ** 8:

    print(ans)

else:

    print((-1))

import sys

sys.setrecursionlimit(10 ** 6)





def dfs(n, v, m):

    global N, M, X

    rst = 10 ** 8

    if n == N:

        if all(x >= X for x in m):

            rst = v

    else:

        nv = v + C[n]

        nm = tuple(m[i] + A[n][i] for i in range(M))

        rst = min(dfs(n + 1, v, m), dfs(n + 1, nv, nm))

    return rst





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

A = [None] * N

C = [None] * N

for i, s in enumerate(sys.stdin.readlines()):

    C[i], *A[i] = list(map(int, s.split()))



rst = dfs(0, 0, tuple([0] * M))

ans = rst if rst < 10 ** 8 else -1

print(ans)

import sys

N, M, X = list(map(int, input().split()))
A = [None] * N
C = [None] * N
for i, s in enumerate(sys.stdin.readlines()):
    C[i], *A[i] = list(map(int, s.split()))
ans = 10**8
for i in range(1 << N):
    k = 0
    v = 0
    S = [0] * M
    while (i >> k) > 0:
        if (i >> k) & 1:
            for j in range(M):
                S[j] += A[k][j]
            v += C[k]
        k += 1
    if all(a >= X for a in S):
        ans = min(ans, v)
if ans < 10**8:
    print(ans)
else:
    print((-1))

import sys

sys.setrecursionlimit(10**6)


def dfs(n, v, m):
    global N, M, X
    rst = 10**8
    if n == N:
        if all(x >= X for x in m):
            rst = v
    else:
        nv = v + C[n]
        nm = tuple(m[i] + A[n][i] for i in range(M))
        rst = min(dfs(n + 1, v, m), dfs(n + 1, nv, nm))
    return rst


N, M, X = list(map(int, input().split()))
A = [None] * N
C = [None] * N
for i, s in enumerate(sys.stdin.readlines()):
    C[i], *A[i] = list(map(int, s.split()))
rst = dfs(0, 0, tuple([0] * M))
ans = rst if rst < 10**8 else -1
print(ans)

+ +sys.setrecursionlimit(10**6) + + +def dfs(n, v, m): +    global N, M, X +    rst = 10**8 +    if n == N: +        if all(x >= X for x in m): +            rst = v +    else: +        nv = v + C[n] +        nm = tuple(m[i] + A[n][i] for i in range(M)) +        rst = min(dfs(n + 1, v, m), dfs(n + 1, nv, nm)) +    return rst + -ans = 10**8 -for i in range(1 << N): -    k = 0 -    v = 0 -    S = [0] * M -    while (i >> k) > 0: -        if (i >> k) & 1: -            for j in range(M): -                S[j] += A[k][j] -            v += C[k] -        k += 1 -    if all(a >= X for a in S): -        ans = min(ans, v) -if ans < 10**8: -    print(ans) -else: -    print((-1)) +rst = dfs(0, 0, tuple([0] * M)) +ans = rst if rst < 10**8 else -1 +print(ans)