import sys

n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))

lines = [ [int(s) for s in line.split()] for line in sys.stdin ]



books = {}

num = 0

for a in range(2):

    for b in range(2):

        for c in range(2):

            for d in range(2):

                for e in range(2):

                    for f in range(2):

                        for g in range(2):

                            for h in range(2):

                                for i in range(2):

                                    for j in range(2):

                                        for k in range(2):

                                            for l in range(2):

                                                books[num] = [a,b,c,d,e,f,g,h,i,j,k,l]

                                                num += 1

price = -1

skill = {}

for i in range(2**12-1):

    price_ = 0

    for j in range (m):

        skill[j] = 0

    for j in range(n):

        if books[i+1][j] == 1:

            price_  += lines[j][0]

            for k in range(m):

                skill[k] = skill[k] + lines[j][k+1]

        for k in range(m):

            if skill[k] < x:

                break

        else:

            if price == -1:

                price = price_

            else:

                price = min(price, price_)

print(price)
import sys

n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))

lines = [ [int(s) for s in line.split()] for line in sys.stdin ]

price = -1

skill = {}

for i in range(2**n-1):

    i = format(i+1, 'b').zfill(n)

    price_ = 0

    for j in range (m):

        skill[j] = 0

    for k in range(n):

        if i[k] == '1':

            price_  += lines[k][0]

            for j in range(m):

                skill[j] = skill[j] + lines[k][j+1]

    for j in range(m):

        if skill[j] < x:

            break

    else:

        if price == -1:

            price = price_

        else:

            price = min(price, price_)

print(price)
import sys

n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
books = {}
num = 0
for a in range(2):
    for b in range(2):
        for c in range(2):
            for d in range(2):
                for e in range(2):
                    for f in range(2):
                        for g in range(2):
                            for h in range(2):
                                for i in range(2):
                                    for j in range(2):
                                        for k in range(2):
                                            for l in range(2):
                                                books[num] = [
                                                    a,
                                                    b,
                                                    c,
                                                    d,
                                                    e,
                                                    f,
                                                    g,
                                                    h,
                                                    i,
                                                    j,
                                                    k,
                                                    l,
                                                ]
                                                num += 1
price = -1
skill = {}
for i in range(2**12 - 1):
    price_ = 0
    for j in range(m):
        skill[j] = 0
    for j in range(n):
        if books[i + 1][j] == 1:
            price_ += lines[j][0]
            for k in range(m):
                skill[k] = skill[k] + lines[j][k + 1]
        for k in range(m):
            if skill[k] < x:
                break
        else:
            if price == -1:
                price = price_
            else:
                price = min(price, price_)
print(price)

import sys

n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
price = -1
skill = {}
for i in range(2**n - 1):
    i = format(i + 1, "b").zfill(n)
    price_ = 0
    for j in range(m):
        skill[j] = 0
    for k in range(n):
        if i[k] == "1":
            price_ += lines[k][0]
            for j in range(m):
                skill[j] = skill[j] + lines[k][j + 1]
    for j in range(m):
        if skill[j] < x:
            break
    else:
        if price == -1:
            price = price_
        else:
            price = min(price, price_)
print(price)

-books = {} -num = 0 -for a in range(2): -    for b in range(2): -        for c in range(2): -            for d in range(2): -                for e in range(2): -                    for f in range(2): -                        for g in range(2): -                            for h in range(2): -                                for i in range(2): -                                    for j in range(2): -                                        for k in range(2): -                                            for l in range(2): -                                                books[num] = [ -                                                    a, -                                                    b, -                                                    c, -                                                    d, -                                                    e, -                                                    f, -                                                    g, -                                                    h, -                                                    i, -                                                    j, -                                                    k, -                                                    l, -                                                ] -                                                num += 1 -for i in range(2**12 - 1): +for i in range(2**n - 1): +    i = format(i + 1, "b").zfill(n) -    for j in range(n): -        if books[i + 1][j] == 1: -            price_ += lines[j][0] -            for k in range(m): -                skill[k] = skill[k] + lines[j][k + 1] -        for k in range(m): -            if skill[k] < x: -                break +    for k in range(n): +        if i[k] == "1": +            price_ += lines[k][0] +            for j in range(m): +                skill[j] = skill[j] + lines[k][j + 1] +    for j in range(m): +        if skill[j] < x: +            break +    else: +        if price == -1: +            price = price_ -            if price == -1: -                price = price_ -            else: -                price = min(price, price_) +            price = min(price, price_)