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



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

import itertools



targets = list(itertools.product([0, 1], repeat=N))

#print(targets)

answer = 10 ** 9

for target in targets:

    result = [0] * (M + 1)

    for i, t in enumerate(target):

        if t == 1:

            for j in range(M + 1):

                result[j] += C_list[i][j]

        #print(result)

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

        #print(result)

        answer = min(answer,result[0])

if answer == 10 ** 9:

    print((-1))

else:

    print(answer)
'''

productでrepeatすればいいよ、

0,1リスト生成

minでとれたね

enumerateは手前がindex,valueの順



'''

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



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

import itertools



#print(targets)

answer = 10 ** 9

for i in range(0,1 << N):

    result = [0] * (M + 1)

    for j in range(N):

        if (i >> j) % 2 == 1:

            for k in range(M + 1):

                result[k] += C_list[j][k]

        #print(result)

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

        #print(result)

        answer = min(answer,result[0])

if answer == 10 ** 9:

    print((-1))

else:

    print(answer)

N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools

targets = list(itertools.product([0, 1], repeat=N))
# print(targets)
answer = 10**9
for target in targets:
    result = [0] * (M + 1)
    for i, t in enumerate(target):
        if t == 1:
            for j in range(M + 1):
                result[j] += C_list[i][j]
        # print(result)
    if min(result[1:]) >= X:
        # print(result)
        answer = min(answer, result[0])
if answer == 10**9:
    print((-1))
else:
    print(answer)

"""
productでrepeatすればいいよ、
0,1リスト生成
minでとれたね
enumerateは手前がindex,valueの順
"""
N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools

# print(targets)
answer = 10**9
for i in range(0, 1 << N):
    result = [0] * (M + 1)
    for j in range(N):
        if (i >> j) % 2 == 1:
            for k in range(M + 1):
                result[k] += C_list[j][k]
        # print(result)
    if min(result[1:]) >= X:
        # print(result)
        answer = min(answer, result[0])
if answer == 10**9:
    print((-1))
else:
    print(answer)

+""" +productでrepeatすればいいよ、 +0,1リスト生成 +minでとれたね +enumerateは手前がindex,valueの順 +""" -targets = list(itertools.product([0, 1], repeat=N)) -for target in targets: +for i in range(0, 1 << N): -    for i, t in enumerate(target): -        if t == 1: -            for j in range(M + 1): -                result[j] += C_list[i][j] +    for j in range(N): +        if (i >> j) % 2 == 1: +            for k in range(M + 1): +                result[k] += C_list[j][k]