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

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

ans = inf = 10**18

for bit in range(1<<n): #  [0,(2^N)-1] full search

    cost = 0

    skill = [0]*m

    for book in range(n): # [0,N-1] book no.

        if(bit>>book & 1): # buy

            cost += books[book][0]

            for j in range(m): skill[j] += books[book][j+1] # skill get

    if min(skill) >= x: ans = min(ans, cost)

if ans == inf: ans = -1

print(ans)

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

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

ans = inf = 10**18

for bit in range(1<<n): #  [0,(2^N)-1] combination full search

    cost = 0

    skill = [0]*m

    for book in range(n): # [0,N-1] book no.

        if(bit>>book & 1): # buy

            cost += books[book][0] # cost get

            skill = [*list(map(lambda x,y: x+y, skill, books[book][1:]))] # skill get

    if min(skill) >= x: ans = min(ans, cost) # skill check

if ans == inf: ans = -1 # exist?

print(ans)

n, m, x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1 << n):  #  [0,(2^N)-1] full search
    cost = 0
    skill = [0] * m
    for book in range(n):  # [0,N-1] book no.
        if bit >> book & 1:  # buy
            cost += books[book][0]
            for j in range(m):
                skill[j] += books[book][j + 1]  # skill get
    if min(skill) >= x:
        ans = min(ans, cost)
if ans == inf:
    ans = -1
print(ans)

n, m, x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1 << n):  #  [0,(2^N)-1] combination full search
    cost = 0
    skill = [0] * m
    for book in range(n):  # [0,N-1] book no.
        if bit >> book & 1:  # buy
            cost += books[book][0]  # cost get
            skill = [
                *list(map(lambda x, y: x + y, skill, books[book][1:]))
            ]  # skill get
    if min(skill) >= x:
        ans = min(ans, cost)  # skill check
if ans == inf:
    ans = -1  # exist?
print(ans)

-for bit in range(1 << n):  #  [0,(2^N)-1] full search +for bit in range(1 << n):  #  [0,(2^N)-1] combination full search -            cost += books[book][0] -            for j in range(m): -                skill[j] += books[book][j + 1]  # skill get +            cost += books[book][0]  # cost get +            skill = [ +                *list(map(lambda x, y: x + y, skill, books[book][1:])) +            ]  # skill get -        ans = min(ans, cost) +        ans = min(ans, cost)  # skill check -    ans = -1 +    ans = -1  # exist?