import itertools

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

lis=tuple(tuple(map(int,input().split())) for _ in range(n)) #再代入しないので二次元tupleでよい

ans=float("inf")



for choice in itertools.product(list(range(2)),repeat=n):#0,1のbit全探索

    cost=0

    skills=[0]*m

    for flag,book in zip(choice,lis):

        if flag:

            C,A = book[0],book[1:]

            cost += book[0]

            for i,a in enumerate(A):

                skills[i]+=a

    if all(v>=x for v in skills):

        ans=min(ans,cost)

if ans==float("inf"):

    print((-1))

else:

    print(ans)
import itertools

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

lis=tuple(tuple(map(int,input().split())) for _ in range(n)) #再代入しないので二次元tupleでよい

ans=float("inf")



def dfs(progress,skills,nowcost):#実行前においておけば参照できる

    global ans

    if progress==n:

        if all(v>=x for v in skills):

            ans=min(ans,nowcost)

        return 0

    dfs(progress+1,skills,nowcost)

    dfs(progress+1,[a+b for a,b in zip(skills,lis[progress][1:])],nowcost+lis[progress][0])



dfs(0,[0]*m,0)

if ans==float("inf"):

    print((-1))

else:

    print(ans)
import itertools

n, m, x = list(map(int, input().split()))
lis = tuple(tuple(map(int, input().split())) for _ in range(n))  # 再代入しないので二次元tupleでよい
ans = float("inf")
for choice in itertools.product(list(range(2)), repeat=n):  # 0,1のbit全探索
    cost = 0
    skills = [0] * m
    for flag, book in zip(choice, lis):
        if flag:
            C, A = book[0], book[1:]
            cost += book[0]
            for i, a in enumerate(A):
                skills[i] += a
    if all(v >= x for v in skills):
        ans = min(ans, cost)
if ans == float("inf"):
    print((-1))
else:
    print(ans)

import itertools

n, m, x = list(map(int, input().split()))
lis = tuple(tuple(map(int, input().split())) for _ in range(n))  # 再代入しないので二次元tupleでよい
ans = float("inf")


def dfs(progress, skills, nowcost):  # 実行前においておけば参照できる
    global ans
    if progress == n:
        if all(v >= x for v in skills):
            ans = min(ans, nowcost)
        return 0
    dfs(progress + 1, skills, nowcost)
    dfs(
        progress + 1,
        [a + b for a, b in zip(skills, lis[progress][1:])],
        nowcost + lis[progress][0],
    )


dfs(0, [0] * m, 0)
if ans == float("inf"):
    print((-1))
else:
    print(ans)

-for choice in itertools.product(list(range(2)), repeat=n):  # 0,1のbit全探索 -    cost = 0 -    skills = [0] * m -    for flag, book in zip(choice, lis): -        if flag: -            C, A = book[0], book[1:] -            cost += book[0] -            for i, a in enumerate(A): -                skills[i] += a -    if all(v >= x for v in skills): -        ans = min(ans, cost) + + +def dfs(progress, skills, nowcost):  # 実行前においておけば参照できる +    global ans +    if progress == n: +        if all(v >= x for v in skills): +            ans = min(ans, nowcost) +        return 0 +    dfs(progress + 1, skills, nowcost) +    dfs( +        progress + 1, +        [a + b for a, b in zip(skills, lis[progress][1:])], +        nowcost + lis[progress][0], +    ) + + +dfs(0, [0] * m, 0)