n, m, x = list(map(int, input().split()))

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

bi_list = [bin(i)[2:] for i in range(2**n)] 

comb = [0] * (m+1)

comb[0] = 10**7

for i in bi_list:#本の選択パターン選択

    dig = len(i) 

    state = [0] * (m+1)

    for j in range(dig):#iから本の選択

        if i[dig-1-j] == '1':

            for k in range(m+1):#本の数値入力

                state[k] += l[n-1-j][k]

    for p in range(m):

        if state[m - p] < x:

            break

    else:

        if state[0] < comb[0]:

            comb = state

if comb[m] == 0:

    print((-1))

else:

    print((comb[0]))
#Cbit全探索

n, m, x = list(map(int, input().split()))

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

ans = [0]*(m+1); ans[0] = 10**7  

for i in range(2**n):

    state = [0]*(m+1)

    for j in range(n):

        if (i >> j) & 1:

             for k in range(m+1):

                state[k] += books[n-1-j][k]

    for j in range(1,m+1):

        if state[j] < x:

            break

    else:

        if ans[0] >= state[0]:

            ans = state

if ans[0] == 10**7:

	print((-1))

else:

  print((ans[0]))
n, m, x = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
bi_list = [bin(i)[2:] for i in range(2**n)]
comb = [0] * (m + 1)
comb[0] = 10**7
for i in bi_list:  # 本の選択パターン選択
    dig = len(i)
    state = [0] * (m + 1)
    for j in range(dig):  # iから本の選択
        if i[dig - 1 - j] == "1":
            for k in range(m + 1):  # 本の数値入力
                state[k] += l[n - 1 - j][k]
    for p in range(m):
        if state[m - p] < x:
            break
    else:
        if state[0] < comb[0]:
            comb = state
if comb[m] == 0:
    print((-1))
else:
    print((comb[0]))

# Cbit全探索
n, m, x = list(map(int, input().split()))
books = [list(map(int, input().split())) for i in range(n)]
ans = [0] * (m + 1)
ans[0] = 10**7
for i in range(2**n):
    state = [0] * (m + 1)
    for j in range(n):
        if (i >> j) & 1:
            for k in range(m + 1):
                state[k] += books[n - 1 - j][k]
    for j in range(1, m + 1):
        if state[j] < x:
            break
    else:
        if ans[0] >= state[0]:
            ans = state
if ans[0] == 10**7:
    print((-1))
else:
    print((ans[0]))

+# Cbit全探索 -l = [list(map(int, input().split())) for i in range(n)] -bi_list = [bin(i)[2:] for i in range(2**n)] -comb = [0] * (m + 1) -comb[0] = 10**7 -for i in bi_list:  # 本の選択パターン選択 -    dig = len(i) +books = [list(map(int, input().split())) for i in range(n)] +ans = [0] * (m + 1) +ans[0] = 10**7 +for i in range(2**n): -    for j in range(dig):  # iから本の選択 -        if i[dig - 1 - j] == "1": -            for k in range(m + 1):  # 本の数値入力 -                state[k] += l[n - 1 - j][k] -    for p in range(m): -        if state[m - p] < x: +    for j in range(n): +        if (i >> j) & 1: +            for k in range(m + 1): +                state[k] += books[n - 1 - j][k] +    for j in range(1, m + 1): +        if state[j] < x: -        if state[0] < comb[0]: -            comb = state -if comb[m] == 0: +        if ans[0] >= state[0]: +            ans = state +if ans[0] == 10**7: -    print((comb[0])) +    print((ans[0]))