import itertools

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

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

cnt = [i for i in range(n)]

ans = 10**12

ok = False

for i in range(1,n+1):

    for conb in itertools.combinations(cnt, i):

        z = [0]*(m+1)

        for j in conb:

            for k in range(m+1):

                z[k] = z[k] + ca[j][k]

            if sum(l >= x for l in z[1:]) == m:

                ans = min(ans, z[0])

                ok = True

if ok:

    print(ans)

else:

    print((-1))

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

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

ans = 10**111

ok = False

for i in range(2**n):

    y = [0]*(m+1)

    for j in range(n):

        if i & (1 << j):

            for k in range(m+1):

                y[k] = y[k] + ca[j][k]

    if sum(z >= x for z in y[1:]) == m:

        ans = min(ans, y[0])

        ok = True

if ok:

    print(ans)

else:

    print((-1))

import itertools

n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
cnt = [i for i in range(n)]
ans = 10**12
ok = False
for i in range(1, n + 1):
    for conb in itertools.combinations(cnt, i):
        z = [0] * (m + 1)
        for j in conb:
            for k in range(m + 1):
                z[k] = z[k] + ca[j][k]
            if sum(l >= x for l in z[1:]) == m:
                ans = min(ans, z[0])
                ok = True
if ok:
    print(ans)
else:
    print((-1))

n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
ans = 10**111
ok = False
for i in range(2**n):
    y = [0] * (m + 1)
    for j in range(n):
        if i & (1 << j):
            for k in range(m + 1):
                y[k] = y[k] + ca[j][k]
    if sum(z >= x for z in y[1:]) == m:
        ans = min(ans, y[0])
        ok = True
if ok:
    print(ans)
else:
    print((-1))

-import itertools - -cnt = [i for i in range(n)] -ans = 10**12 +ans = 10**111 -for i in range(1, n + 1): -    for conb in itertools.combinations(cnt, i): -        z = [0] * (m + 1) -        for j in conb: +for i in range(2**n): +    y = [0] * (m + 1) +    for j in range(n): +        if i & (1 << j): -                z[k] = z[k] + ca[j][k] -            if sum(l >= x for l in z[1:]) == m: -                ans = min(ans, z[0]) -                ok = True +                y[k] = y[k] + ca[j][k] +    if sum(z >= x for z in y[1:]) == m: +        ans = min(ans, y[0]) +        ok = True