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

a = []

for i in range(n):

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

ans = 10**9

for i in range(2**n):

    book_list = [0] * (m+1)

    for j in range(n):

        if i>>j&1:

            for q,p in enumerate(a[j]):

                if q == 0:continue

                book_list[q-1] += p

            book_list[-1] += a[j][0]

    f = 1

    for y in range(m):

        if book_list[y] < x:

            f = 0

            break

    if f == 1:

        ans = min(ans,book_list[-1])

if ans == 10**9:

    print((-1));exit()

print(ans)

import sys

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9 + 7

input = sys.stdin.readline



def inp():

    return int(eval(input()))

def inpl():

    return list(map(int,input().split()))

def inpm():

    return list(map(int,input().split()))



ans = INF



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

a = [inpl() for _ in range(n)]



for i in range(1<<n):

    money = 0

    score = [0] * m

    for j in range(n):

        if i>>j&1:

            money += a[j][0]

            for k in range(m):

                score[k] += a[j][k+1]

    for s in score:

        if s < x:

            break

    else:

        ans = min(ans,money)



print((ans if ans != INF else -1))

n, m, x = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
ans = 10**9
for i in range(2**n):
    book_list = [0] * (m + 1)
    for j in range(n):
        if i >> j & 1:
            for q, p in enumerate(a[j]):
                if q == 0:
                    continue
                book_list[q - 1] += p
            book_list[-1] += a[j][0]
    f = 1
    for y in range(m):
        if book_list[y] < x:
            f = 0
            break
    if f == 1:
        ans = min(ans, book_list[-1])
if ans == 10**9:
    print((-1))
    exit()
print(ans)

import sys

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
input = sys.stdin.readline


def inp():
    return int(eval(input()))


def inpl():
    return list(map(int, input().split()))


def inpm():
    return list(map(int, input().split()))


ans = INF
n, m, x = list(map(int, input().split()))
a = [inpl() for _ in range(n)]
for i in range(1 << n):
    money = 0
    score = [0] * m
    for j in range(n):
        if i >> j & 1:
            money += a[j][0]
            for k in range(m):
                score[k] += a[j][k + 1]
    for s in score:
        if s < x:
            break
    else:
        ans = min(ans, money)
print((ans if ans != INF else -1))

+import sys + +sys.setrecursionlimit(10**8) +INF = float("inf") +mod = 10**9 + 7 +input = sys.stdin.readline + + +def inp(): +    return int(eval(input())) + + +def inpl(): +    return list(map(int, input().split())) + + +def inpm(): +    return list(map(int, input().split())) + + +ans = INF -a = [] -for i in range(n): -    a.append(list(map(int, input().split()))) -ans = 10**9 -for i in range(2**n): -    book_list = [0] * (m + 1) +a = [inpl() for _ in range(n)] +for i in range(1 << n): +    money = 0 +    score = [0] * m -            for q, p in enumerate(a[j]): -                if q == 0: -                    continue -                book_list[q - 1] += p -            book_list[-1] += a[j][0] -    f = 1 -    for y in range(m): -        if book_list[y] < x: -            f = 0 +            money += a[j][0] +            for k in range(m): +                score[k] += a[j][k + 1] +    for s in score: +        if s < x: -    if f == 1: -        ans = min(ans, book_list[-1]) -if ans == 10**9: -    print((-1)) -    exit() -print(ans) +    else: +        ans = min(ans, money) +print((ans if ans != INF else -1))