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

n,m,x=number[0],number[1],number[2]

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

U=[x for i in range(m+1)]

U[0]=0

pattern=[]

answer=[]





for i in range(2**n):

    tmp=[False]*n

    for j in range(n):

        if (i>>j)&1:

            tmp[j]=True

    

    pattern.append(tmp)



for i in range(2**n):

    cost=0

    U=[x for i in range(m+1)]

    U[0]=0

    for j in range(n):

        if pattern[i][j]==True:

            cost+=books[j][0]

            for k in range(1,m+1):

                U[k]-=books[j][k]

                if max(U)==0:

                    answer.append(cost)

                    break

                    

if answer==[]:

    print((-1))

else:

    print((min(answer)))

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

N,M,X=number[0],number[1],number[2]

price=0

nums=[]

for i in range(N):

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

    nums.append(tmp)

target=[0 for i in range(M)]

answer=10000000

for cowmask in range(1<<N):

        price=0

        target=[0 for k in range(M)]

        for x in range(N):

                if (cowmask>>x)&1==0:

                    price+=nums[x][0]

                    for j in range(1,M+1):

                        target[j-1]+=nums[x][j]

        if min(target)>=X:

            answer=min(answer,price)



if answer==10000000:

    print((-1))

else:

    print(answer)
number = list(map(int, input().split()))
n, m, x = number[0], number[1], number[2]
books = [list(map(int, input().split())) for i in range(n)]
U = [x for i in range(m + 1)]
U[0] = 0
pattern = []
answer = []
for i in range(2**n):
    tmp = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            tmp[j] = True
    pattern.append(tmp)
for i in range(2**n):
    cost = 0
    U = [x for i in range(m + 1)]
    U[0] = 0
    for j in range(n):
        if pattern[i][j] == True:
            cost += books[j][0]
            for k in range(1, m + 1):
                U[k] -= books[j][k]
                if max(U) == 0:
                    answer.append(cost)
                    break
if answer == []:
    print((-1))
else:
    print((min(answer)))

number = list(map(int, input().split()))
N, M, X = number[0], number[1], number[2]
price = 0
nums = []
for i in range(N):
    tmp = list(map(int, input().split()))
    nums.append(tmp)
target = [0 for i in range(M)]
answer = 10000000
for cowmask in range(1 << N):
    price = 0
    target = [0 for k in range(M)]
    for x in range(N):
        if (cowmask >> x) & 1 == 0:
            price += nums[x][0]
            for j in range(1, M + 1):
                target[j - 1] += nums[x][j]
    if min(target) >= X:
        answer = min(answer, price)
if answer == 10000000:
    print((-1))
else:
    print(answer)

-n, m, x = number[0], number[1], number[2] -books = [list(map(int, input().split())) for i in range(n)] -U = [x for i in range(m + 1)] -U[0] = 0 -pattern = [] -answer = [] -for i in range(2**n): -    tmp = [False] * n -    for j in range(n): -        if (i >> j) & 1: -            tmp[j] = True -    pattern.append(tmp) -for i in range(2**n): -    cost = 0 -    U = [x for i in range(m + 1)] -    U[0] = 0 -    for j in range(n): -        if pattern[i][j] == True: -            cost += books[j][0] -            for k in range(1, m + 1): -                U[k] -= books[j][k] -                if max(U) == 0: -                    answer.append(cost) -                    break -if answer == []: +N, M, X = number[0], number[1], number[2] +price = 0 +nums = [] +for i in range(N): +    tmp = list(map(int, input().split())) +    nums.append(tmp) +target = [0 for i in range(M)] +answer = 10000000 +for cowmask in range(1 << N): +    price = 0 +    target = [0 for k in range(M)] +    for x in range(N): +        if (cowmask >> x) & 1 == 0: +            price += nums[x][0] +            for j in range(1, M + 1): +                target[j - 1] += nums[x][j] +    if min(target) >= X: +        answer = min(answer, price) +if answer == 10000000: -    print((min(answer))) +    print(answer)