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

books = []

ans = float('inf')

for _ in range(n):

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

    books.append(book)



for i in range(2**n):

    count = [0] * m

    book_price = 0

    for j in range(n):

        if (i >> j) & 1:

            book_price += books[j][0]

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

                count[k-1] += books[j][k]

    check = True

    for j in count:

        if j < x:

            check = False

            break

    if check:

        ans = min(ans, book_price)

if ans == float('inf'):

    print('-1')

else:

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

books = []

book_total_price = []

for _ in range(n):

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

    books.append(book)

 

for i in range(2**n):

    reference_book = []

    book_price = 0

    for j in range(n):

        if (i >> j) & 1:

            reference_book.append(books[j])

            book_price += books[j][0]

    err = 0

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

        r = [row[k] for row in reference_book]

        if sum(r) < x:

            err += 1

    if err == 0:

        book_total_price.append(book_price)

if book_total_price == []:

    print('-1')

else:

    print((min(book_total_price)))
n, m, x = list(map(int, input().split()))
books = []
ans = float("inf")
for _ in range(n):
    book = list(map(int, input().split()))
    books.append(book)
for i in range(2**n):
    count = [0] * m
    book_price = 0
    for j in range(n):
        if (i >> j) & 1:
            book_price += books[j][0]
            for k in range(1, m + 1):
                count[k - 1] += books[j][k]
    check = True
    for j in count:
        if j < x:
            check = False
            break
    if check:
        ans = min(ans, book_price)
if ans == float("inf"):
    print("-1")
else:
    print(ans)

n, m, x = list(map(int, input().split()))
books = []
book_total_price = []
for _ in range(n):
    book = list(map(int, input().split()))
    books.append(book)
for i in range(2**n):
    reference_book = []
    book_price = 0
    for j in range(n):
        if (i >> j) & 1:
            reference_book.append(books[j])
            book_price += books[j][0]
    err = 0
    for k in range(1, m + 1):
        r = [row[k] for row in reference_book]
        if sum(r) < x:
            err += 1
    if err == 0:
        book_total_price.append(book_price)
if book_total_price == []:
    print("-1")
else:
    print((min(book_total_price)))

-ans = float("inf") +book_total_price = [] -    count = [0] * m +    reference_book = [] +            reference_book.append(books[j]) -            for k in range(1, m + 1): -                count[k - 1] += books[j][k] -    check = True -    for j in count: -        if j < x: -            check = False -            break -    if check: -        ans = min(ans, book_price) -if ans == float("inf"): +    err = 0 +    for k in range(1, m + 1): +        r = [row[k] for row in reference_book] +        if sum(r) < x: +            err += 1 +    if err == 0: +        book_total_price.append(book_price) +if book_total_price == []: -    print(ans) +    print((min(book_total_price)))