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

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

ans = 10**10

for i in range(2**N):

    cost = 0

    rikai = [0 for i in range(M)]

    for j in range(N):

        if i>>j&1:

            cost += A[j][0]

            for k in range(M):

                rikai[k] += A[j][k+1]

    b = True

    for k in range(M):

        if rikai[k] >= X:

            continue

        b = False

    if b:

        ans = min(ans,cost)

print((-1 if ans == 10**10 else ans))



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

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

ans = 10**10

for i in range(2**N):

    cost = 0

    rikai = [0 for i in range(M)]

    for j in range(N):

        if i>>j&1:

            cost += A[j][0]

            for k in range(M):

                rikai[k] += A[j][k+1]

    if min(rikai) >= X:

        ans = min(ans,cost)

print((-1 if ans == 10**10 else ans))



N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
    cost = 0
    rikai = [0 for i in range(M)]
    for j in range(N):
        if i >> j & 1:
            cost += A[j][0]
            for k in range(M):
                rikai[k] += A[j][k + 1]
    b = True
    for k in range(M):
        if rikai[k] >= X:
            continue
        b = False
    if b:
        ans = min(ans, cost)
print((-1 if ans == 10**10 else ans))

N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
    cost = 0
    rikai = [0 for i in range(M)]
    for j in range(N):
        if i >> j & 1:
            cost += A[j][0]
            for k in range(M):
                rikai[k] += A[j][k + 1]
    if min(rikai) >= X:
        ans = min(ans, cost)
print((-1 if ans == 10**10 else ans))

-    b = True -    for k in range(M): -        if rikai[k] >= X: -            continue -        b = False -    if b: +    if min(rikai) >= X: