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

C = []

L = []

for i in range(N):

    B = list(map(int, input().split()))

    C.append(B[0])

    L.append(B[1:])



res = 10 ** 9

for i in range(2 ** N):

    c = 0

    s = [0 for _ in range(M)]

    for j in range(N):

        if i >> j & 1:

            c += C[j]

            for k in range(M):

                s[k] += L[j][k]

    f = 1

    for j in range(M):

        if s[j] < X:

            f = 0

            break

    if f:

        res = min(res, c)



if res == 10 ** 9:

    print((-1))

else:

    print(res)

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

C = []

L = []

for i in range(N):

    B = list(map(int, input().split()))

    C.append(B[0])

    L.append(B[1:])



res = 10 ** 9

for i in range(2 ** N):

    c = 0

    s = [0 for _ in range(M)]

    for j in range(N):

        if i >> j & 1:

            c += C[j]

            for k in range(M):

                s[k] += L[j][k]

    for j in range(M):

        if s[j] < X:

            break

    else:

        res = min(res, c)



if res == 10 ** 9:

    print((-1))

else:

    print(res)

N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
    B = list(map(int, input().split()))
    C.append(B[0])
    L.append(B[1:])
res = 10**9
for i in range(2**N):
    c = 0
    s = [0 for _ in range(M)]
    for j in range(N):
        if i >> j & 1:
            c += C[j]
            for k in range(M):
                s[k] += L[j][k]
    f = 1
    for j in range(M):
        if s[j] < X:
            f = 0
            break
    if f:
        res = min(res, c)
if res == 10**9:
    print((-1))
else:
    print(res)

N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
    B = list(map(int, input().split()))
    C.append(B[0])
    L.append(B[1:])
res = 10**9
for i in range(2**N):
    c = 0
    s = [0 for _ in range(M)]
    for j in range(N):
        if i >> j & 1:
            c += C[j]
            for k in range(M):
                s[k] += L[j][k]
    for j in range(M):
        if s[j] < X:
            break
    else:
        res = min(res, c)
if res == 10**9:
    print((-1))
else:
    print(res)

-    f = 1 -            f = 0 -    if f: +    else: