import numpy as np

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

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



ans = np.inf

flag = 0

for i in range(2**n):

    r = np.array([0]*(m+1))

    for j in range(n):

        if (i>>j)&1:

            for k in range(m+1): r[k] += a[j][k]

    if np.all(r[1:]>=x):

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

        flag = 1

    else: flag = 0



if flag: print(ans)

else: print("-1")

import numpy as np

import sys



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

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



c = arr.T[0] # c[n-1]まで

a = arr.T[1:].T # a[n-1][m-1]まで





ans = np.inf

for i in range(2**n):

    ability = np.zeros(m, np.int64)

    cost = 0

    for j in range(n):

        if (i>>j)&1: ability += a[j] ; cost += c[j]

    #print(ability, cost)

    if all(i>=x for i in ability): ans = min(ans,cost)



ans = -1 if ans==np.inf else ans

print(ans)

import numpy as np

n, m, x = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
ans = np.inf
flag = 0
for i in range(2**n):
    r = np.array([0] * (m + 1))
    for j in range(n):
        if (i >> j) & 1:
            for k in range(m + 1):
                r[k] += a[j][k]
    if np.all(r[1:] >= x):
        if ans > r[0]:
            ans = r[0]
        flag = 1
    else:
        flag = 0
if flag:
    print(ans)
else:
    print("-1")

import numpy as np
import sys

n, m, x = list(map(int, input().split()))
arr = np.array([list(map(int, input().split())) for i in range(n)])
c = arr.T[0]  # c[n-1]まで
a = arr.T[1:].T  # a[n-1][m-1]まで
ans = np.inf
for i in range(2**n):
    ability = np.zeros(m, np.int64)
    cost = 0
    for j in range(n):
        if (i >> j) & 1:
            ability += a[j]
            cost += c[j]
    # print(ability, cost)
    if all(i >= x for i in ability):
        ans = min(ans, cost)
ans = -1 if ans == np.inf else ans
print(ans)

+import sys -a = [list(map(int, input().split())) for i in range(n)] +arr = np.array([list(map(int, input().split())) for i in range(n)]) +c = arr.T[0]  # c[n-1]まで +a = arr.T[1:].T  # a[n-1][m-1]まで -flag = 0 -    r = np.array([0] * (m + 1)) +    ability = np.zeros(m, np.int64) +    cost = 0 -            for k in range(m + 1): -                r[k] += a[j][k] -    if np.all(r[1:] >= x): -        if ans > r[0]: -            ans = r[0] -        flag = 1 -    else: -        flag = 0 -if flag: -    print(ans) -else: -    print("-1") +            ability += a[j] +            cost += c[j] +    # print(ability, cost) +    if all(i >= x for i in ability): +        ans = min(ans, cost) +ans = -1 if ans == np.inf else ans +print(ans)