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

import numpy as np

pr = []

score = []



for i in range(n):

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

    pr.append(li[0])

    score.append(li[1:])



cnt =0

ans = 10**10

for i in range(1<<n):

    tot = np.array([0]*m)

    pr_all = 0

    for j in range(n):

        if i>>j&1:

            score[j] = np.array(score[j])

            tot +=np.array(score[j])

            pr_all +=pr[j]



    if np.all(tot >=k):

        ans = min(ans,pr_all)

        

print((ans if ans <10**10 else -1))
n,m,x = list(map(int,input().split()))

pr = []

score = []

for i in range(n):

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

    pr.append(L[0])

    score.append(L[1:])



ans = 10**10

for i in range(1<<n):

    li = []

    

    cost = 0

    for j in range(n):

        if (i>>j)&1:

            li.append(score[j])

            cost +=pr[j]



    score_all = [0 for l in range(m)]

    for k in range(len(li)):

        for j in range(m):

            score_all[j] +=li[k][j]

    if all([y>=x for y in score_all]):

        ans = min(ans,cost)



if ans != 10**10:

    print(ans)

else:

    print((-1))
n, m, k = list(map(int, input().split()))
import numpy as np

pr = []
score = []
for i in range(n):
    li = list(map(int, input().split()))
    pr.append(li[0])
    score.append(li[1:])
cnt = 0
ans = 10**10
for i in range(1 << n):
    tot = np.array([0] * m)
    pr_all = 0
    for j in range(n):
        if i >> j & 1:
            score[j] = np.array(score[j])
            tot += np.array(score[j])
            pr_all += pr[j]
    if np.all(tot >= k):
        ans = min(ans, pr_all)
print((ans if ans < 10**10 else -1))

n, m, x = list(map(int, input().split()))
pr = []
score = []
for i in range(n):
    L = list(map(int, input().split()))
    pr.append(L[0])
    score.append(L[1:])
ans = 10**10
for i in range(1 << n):
    li = []
    cost = 0
    for j in range(n):
        if (i >> j) & 1:
            li.append(score[j])
            cost += pr[j]
    score_all = [0 for l in range(m)]
    for k in range(len(li)):
        for j in range(m):
            score_all[j] += li[k][j]
    if all([y >= x for y in score_all]):
        ans = min(ans, cost)
if ans != 10**10:
    print(ans)
else:
    print((-1))

-n, m, k = list(map(int, input().split())) -import numpy as np - +n, m, x = list(map(int, input().split())) -    li = list(map(int, input().split())) -    pr.append(li[0]) -    score.append(li[1:]) -cnt = 0 +    L = list(map(int, input().split())) +    pr.append(L[0]) +    score.append(L[1:]) -    tot = np.array([0] * m) -    pr_all = 0 +    li = [] +    cost = 0 -        if i >> j & 1: -            score[j] = np.array(score[j]) -            tot += np.array(score[j]) -            pr_all += pr[j] -    if np.all(tot >= k): -        ans = min(ans, pr_all) -print((ans if ans < 10**10 else -1)) +        if (i >> j) & 1: +            li.append(score[j]) +            cost += pr[j] +    score_all = [0 for l in range(m)] +    for k in range(len(li)): +        for j in range(m): +            score_all[j] += li[k][j] +    if all([y >= x for y in score_all]): +        ans = min(ans, cost) +if ans != 10**10: +    print(ans) +else: +    print((-1))