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

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

com = []



import itertools

for i in range(1,n+1):

    c = list(itertools.combinations(CA,i))

    for j in c:

        com.append(j)

        

ans = 12*(10**5)+1

        

for i in com:

    res = [0]*(m+1)

    

    for j in range(len(i)):

        ca = i[j]

        

        for k in range(m+1):

            res[k] += ca[k]

            

    ok = 0        

    for j in res[1:]:

        if j >= x:

            ok += 1

            

        if ok == m:

            ans = min(ans,res[0])



if ans == 12*(10**5)+1:

    ans = -1

            

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

ans = 12*(10**5)+1

C = []

A = []



for _ in range(n):

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

    C.append(AC[0])

    A.append(AC[1:])



for i in range(2**n):

    understood = [0]*m

    cost = 0

    

    for j in range(n):

        if (i>>j)&1:

            cost += C[j]

            

            for k in range(m):

                understood[k] += A[j][k]

                

    ok = 0

        

    for j in understood:

        if j >= x:

            ok += 1

            

    if ok == m:

        ans = min(ans,cost)



if ans == 12*(10**5)+1:

    ans = -1

        

print(ans)
n, m, x = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(n)]
com = []
import itertools

for i in range(1, n + 1):
    c = list(itertools.combinations(CA, i))
    for j in c:
        com.append(j)
ans = 12 * (10**5) + 1
for i in com:
    res = [0] * (m + 1)
    for j in range(len(i)):
        ca = i[j]
        for k in range(m + 1):
            res[k] += ca[k]
    ok = 0
    for j in res[1:]:
        if j >= x:
            ok += 1
        if ok == m:
            ans = min(ans, res[0])
if ans == 12 * (10**5) + 1:
    ans = -1
print(ans)

n, m, x = list(map(int, input().split()))
ans = 12 * (10**5) + 1
C = []
A = []
for _ in range(n):
    AC = list(map(int, input().split()))
    C.append(AC[0])
    A.append(AC[1:])
for i in range(2**n):
    understood = [0] * m
    cost = 0
    for j in range(n):
        if (i >> j) & 1:
            cost += C[j]
            for k in range(m):
                understood[k] += A[j][k]
    ok = 0
    for j in understood:
        if j >= x:
            ok += 1
    if ok == m:
        ans = min(ans, cost)
if ans == 12 * (10**5) + 1:
    ans = -1
print(ans)

-CA = [list(map(int, input().split())) for i in range(n)] -com = [] -import itertools - -for i in range(1, n + 1): -    c = list(itertools.combinations(CA, i)) -    for j in c: -        com.append(j) -for i in com: -    res = [0] * (m + 1) -    for j in range(len(i)): -        ca = i[j] -        for k in range(m + 1): -            res[k] += ca[k] +C = [] +A = [] +for _ in range(n): +    AC = list(map(int, input().split())) +    C.append(AC[0]) +    A.append(AC[1:]) +for i in range(2**n): +    understood = [0] * m +    cost = 0 +    for j in range(n): +        if (i >> j) & 1: +            cost += C[j] +            for k in range(m): +                understood[k] += A[j][k] -    for j in res[1:]: +    for j in understood: -        if ok == m: -            ans = min(ans, res[0]) +    if ok == m: +        ans = min(ans, cost)