import itertools

ans_li = []

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

li = []

for _ in range(n):

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



for i in range(n):

    if i == 0:

        tmp = [kkk for kkk in range(n)]

        #print(tmp)

        #score_li = [0]*m

        #okane = 0

        #print([k for k in range(n)],i+1,tmp)

        for t in tmp:

            score_li = [0]*m

            okane = 0

            #print(li,t,'ttttt')

            for ii,ll in enumerate(list(li[t])):

                if ii==0:

                    okane += li[t][ii]

                else:

                    #print(score_li,ii,ll)

                    score_li[ii-1]+=ll

            flag = True

            #print(score_li,okane)

            for ss in score_li:

                if ss<x:

                    flag = False

            if flag:

                ans_li.append(okane)



    else:

        tmp = list(itertools.combinations(list(range(n)), i+1))

        #print(tmp)

        #score_li = [0]*m

        #okane = 0

        #print([k for k in range(n)],i+1,tmp)

        for t in tmp:

            score_li = [0]*m

            okane = 0

            #print(li,t,'ttttt')

            for aaa in t:

                for ii,ll in enumerate(list(li[aaa])):

                    if ii==0:

                        okane += li[aaa][ii]

                    else:

                        #print(score_li,ii,ll)

                        score_li[ii-1]+=ll

            flag = True

            for ss in score_li:

                if ss<x:

                    flag = False

            if flag:

                ans_li.append(okane)

#print(ans_li)

if len(ans_li)>0:

    print((min(ans_li)))

else:

    print((-1))
import itertools

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

c_li = []

a_li = []

for _ in range(n):

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

    c_li.append(tmp[0])

    a_li.append(tmp[1:])

kumi = list(itertools.product([0,1], repeat=n))

ans_li = []

for each_kumi in kumi:

    each_li = [0]*m

    score = 0

    for i,k in enumerate(each_kumi):

        if k == 1:

            score += c_li[i]

            for j,kk in enumerate(a_li[i]):

                each_li[j] += kk

    flag = True

    for ea in each_li:

        if ea<x:

            flag = False

    if flag:

        ans_li.append(score)

if len(ans_li)==0:

    print((-1))

else:

    print((min(ans_li)))

import itertools

ans_li = []
n, m, x = list(map(int, input().split()))
li = []
for _ in range(n):
    li.append(list(map(int, input().split())))
for i in range(n):
    if i == 0:
        tmp = [kkk for kkk in range(n)]
        # print(tmp)
        # score_li = [0]*m
        # okane = 0
        # print([k for k in range(n)],i+1,tmp)
        for t in tmp:
            score_li = [0] * m
            okane = 0
            # print(li,t,'ttttt')
            for ii, ll in enumerate(list(li[t])):
                if ii == 0:
                    okane += li[t][ii]
                else:
                    # print(score_li,ii,ll)
                    score_li[ii - 1] += ll
            flag = True
            # print(score_li,okane)
            for ss in score_li:
                if ss < x:
                    flag = False
            if flag:
                ans_li.append(okane)
    else:
        tmp = list(itertools.combinations(list(range(n)), i + 1))
        # print(tmp)
        # score_li = [0]*m
        # okane = 0
        # print([k for k in range(n)],i+1,tmp)
        for t in tmp:
            score_li = [0] * m
            okane = 0
            # print(li,t,'ttttt')
            for aaa in t:
                for ii, ll in enumerate(list(li[aaa])):
                    if ii == 0:
                        okane += li[aaa][ii]
                    else:
                        # print(score_li,ii,ll)
                        score_li[ii - 1] += ll
            flag = True
            for ss in score_li:
                if ss < x:
                    flag = False
            if flag:
                ans_li.append(okane)
# print(ans_li)
if len(ans_li) > 0:
    print((min(ans_li)))
else:
    print((-1))

import itertools

n, m, x = list(map(int, input().split()))
c_li = []
a_li = []
for _ in range(n):
    tmp = list(map(int, input().split()))
    c_li.append(tmp[0])
    a_li.append(tmp[1:])
kumi = list(itertools.product([0, 1], repeat=n))
ans_li = []
for each_kumi in kumi:
    each_li = [0] * m
    score = 0
    for i, k in enumerate(each_kumi):
        if k == 1:
            score += c_li[i]
            for j, kk in enumerate(a_li[i]):
                each_li[j] += kk
    flag = True
    for ea in each_li:
        if ea < x:
            flag = False
    if flag:
        ans_li.append(score)
if len(ans_li) == 0:
    print((-1))
else:
    print((min(ans_li)))

+n, m, x = list(map(int, input().split())) +c_li = [] +a_li = [] +for _ in range(n): +    tmp = list(map(int, input().split())) +    c_li.append(tmp[0]) +    a_li.append(tmp[1:]) +kumi = list(itertools.product([0, 1], repeat=n)) -n, m, x = list(map(int, input().split())) -li = [] -for _ in range(n): -    li.append(list(map(int, input().split()))) -for i in range(n): -    if i == 0: -        tmp = [kkk for kkk in range(n)] -        # print(tmp) -        # score_li = [0]*m -        # okane = 0 -        # print([k for k in range(n)],i+1,tmp) -        for t in tmp: -            score_li = [0] * m -            okane = 0 -            # print(li,t,'ttttt') -            for ii, ll in enumerate(list(li[t])): -                if ii == 0: -                    okane += li[t][ii] -                else: -                    # print(score_li,ii,ll) -                    score_li[ii - 1] += ll -            flag = True -            # print(score_li,okane) -            for ss in score_li: -                if ss < x: -                    flag = False -            if flag: -                ans_li.append(okane) -    else: -        tmp = list(itertools.combinations(list(range(n)), i + 1)) -        # print(tmp) -        # score_li = [0]*m -        # okane = 0 -        # print([k for k in range(n)],i+1,tmp) -        for t in tmp: -            score_li = [0] * m -            okane = 0 -            # print(li,t,'ttttt') -            for aaa in t: -                for ii, ll in enumerate(list(li[aaa])): -                    if ii == 0: -                        okane += li[aaa][ii] -                    else: -                        # print(score_li,ii,ll) -                        score_li[ii - 1] += ll -            flag = True -            for ss in score_li: -                if ss < x: -                    flag = False -            if flag: -                ans_li.append(okane) -# print(ans_li) -if len(ans_li) > 0: +for each_kumi in kumi: +    each_li = [0] * m +    score = 0 +    for i, k in enumerate(each_kumi): +        if k == 1: +            score += c_li[i] +            for j, kk in enumerate(a_li[i]): +                each_li[j] += kk +    flag = True +    for ea in each_li: +        if ea < x: +            flag = False +    if flag: +        ans_li.append(score) +if len(ans_li) == 0: +    print((-1)) +else: -else: -    print((-1))