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

arr=[[0 for i in range(m+1)] for j in range(n)]

b=[0]*18

ans=-1

flag=1

for i in range(n):

    arr[i]=list(map(int,input().split()))

for i in range(2**n):

    b=[0]*18

    for j in range(n):

        flag=1

        if (1& i>>j):

            for s in range(m+1):

                b[s]= b[s]+arr[j][s]

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

            if(b[y]<x):

                flag=0

                

        if flag :

            if ans==-1 or ans>b[0]:

                ans=b[0]

print(ans)

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

a=[[0]*(m+1)]*n

for i in range(n):

    a[i]=list(map(int,input().split()))

b=[0]*(m+1)

flag=True

ans=-1

for i in range(2**n):

    flag=True

    b=[0]*(m+1)

    for j in range(n):

        if(i>>j & 1):

            for y in range(m+1):

                b[y]=b[y]+a[j][y]

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

        if(b[y]<x):

            flag=False

            break

    if(flag):

        if ans<0 or b[0]<ans:

            ans=b[0]

print(ans)
n, m, x = list(map(int, input().split()))
arr = [[0 for i in range(m + 1)] for j in range(n)]
b = [0] * 18
ans = -1
flag = 1
for i in range(n):
    arr[i] = list(map(int, input().split()))
for i in range(2**n):
    b = [0] * 18
    for j in range(n):
        flag = 1
        if 1 & i >> j:
            for s in range(m + 1):
                b[s] = b[s] + arr[j][s]
        for y in range(1, m + 1):
            if b[y] < x:
                flag = 0
        if flag:
            if ans == -1 or ans > b[0]:
                ans = b[0]
print(ans)

n, m, x = list(map(int, input().split()))
a = [[0] * (m + 1)] * n
for i in range(n):
    a[i] = list(map(int, input().split()))
b = [0] * (m + 1)
flag = True
ans = -1
for i in range(2**n):
    flag = True
    b = [0] * (m + 1)
    for j in range(n):
        if i >> j & 1:
            for y in range(m + 1):
                b[y] = b[y] + a[j][y]
    for y in range(1, m + 1):
        if b[y] < x:
            flag = False
            break
    if flag:
        if ans < 0 or b[0] < ans:
            ans = b[0]
print(ans)

-arr = [[0 for i in range(m + 1)] for j in range(n)] -b = [0] * 18 +a = [[0] * (m + 1)] * n +for i in range(n): +    a[i] = list(map(int, input().split())) +b = [0] * (m + 1) +flag = True -flag = 1 -for i in range(n): -    arr[i] = list(map(int, input().split())) -    b = [0] * 18 +    flag = True +    b = [0] * (m + 1) -        flag = 1 -        if 1 & i >> j: -            for s in range(m + 1): -                b[s] = b[s] + arr[j][s] -        for y in range(1, m + 1): -            if b[y] < x: -                flag = 0 -        if flag: -            if ans == -1 or ans > b[0]: -                ans = b[0] +        if i >> j & 1: +            for y in range(m + 1): +                b[y] = b[y] + a[j][y] +    for y in range(1, m + 1): +        if b[y] < x: +            flag = False +            break +    if flag: +        if ans < 0 or b[0] < ans: +            ans = b[0]