N, M, X = list(map(int, input().split()))

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



ans = -1



for bits in range(1 << N):

    cost = 0

    a = [0] * M

    for i in range(N):

        if (bits >> i) & 1 == 1:

            cost += books[i][0]

            for j in range(M):

                a[j] += books[i][j + 1]



    if min(a) >= X:

        ans = min(cost, ans) if ans >= 0 else cost



print(ans)

import itertools



N, M, X = list(map(int, input().split()))

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



ans = -1



for i in range(N):

    for choices in itertools.combinations(list(range(N)), i + 1):

        cost = 0

        a = [0] * M

        for choice in choices:

            cost += books[choice][0]

            for j in range(M):

                a[j] += books[choice][j + 1]



        if min(a) >= X:

            ans = min(cost, ans) if ans >= 0 else cost



print(ans)

N, M, X = list(map(int, input().split()))
books = [list(map(int, input().split())) for _ in range(N)]
ans = -1
for bits in range(1 << N):
    cost = 0
    a = [0] * M
    for i in range(N):
        if (bits >> i) & 1 == 1:
            cost += books[i][0]
            for j in range(M):
                a[j] += books[i][j + 1]
    if min(a) >= X:
        ans = min(cost, ans) if ans >= 0 else cost
print(ans)

import itertools

N, M, X = list(map(int, input().split()))
books = [list(map(int, input().split())) for _ in range(N)]
ans = -1
for i in range(N):
    for choices in itertools.combinations(list(range(N)), i + 1):
        cost = 0
        a = [0] * M
        for choice in choices:
            cost += books[choice][0]
            for j in range(M):
                a[j] += books[choice][j + 1]
        if min(a) >= X:
            ans = min(cost, ans) if ans >= 0 else cost
print(ans)

+import itertools + -for bits in range(1 << N): -    cost = 0 -    a = [0] * M -    for i in range(N): -        if (bits >> i) & 1 == 1: -            cost += books[i][0] +for i in range(N): +    for choices in itertools.combinations(list(range(N)), i + 1): +        cost = 0 +        a = [0] * M +        for choice in choices: +            cost += books[choice][0] -                a[j] += books[i][j + 1] -    if min(a) >= X: -        ans = min(cost, ans) if ans >= 0 else cost +                a[j] += books[choice][j + 1] +        if min(a) >= X: +            ans = min(cost, ans) if ans >= 0 else cost