import numpy as np



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

CA = []

for _ in range(N):

    Ci, *A = list(map(int, input().split()))

    CA.append((Ci, A))



ans = 10**8

studied = np.array([0] * M)



for i in range(2**N):

    flag = True

    tmp_ans = 0

    studied = np.array([0] * M)

    for j in range(N):

        if i >> j & 1:

            tmp_ans += CA[j][0]

            studied += CA[j][1]

    for study in studied:

        if study < X:

            flag = False

            break

    if flag:

        ans = min(ans, tmp_ans)



if ans == 10**8:

    print((-1))

else:

    print(ans)

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

CA = []



for _ in range(N):

    C, *A = list(map(int, input().split()))

    CA.append((C, A))



ans = 10**9

for i in range(2**N):

    flag = True

    tmp_C = 0

    tmp_A = [0]*M

    for j in range(N):

        if i >> j & 1:

            tmp_C += CA[j][0]

            for k in range(M):

                tmp_A[k] += CA[j][1][k]

    for tmp_a in tmp_A:

        if tmp_a < X:

            flag = False

            break

    if flag == True:

        ans = min(ans, tmp_C)



if ans < 10**9:

    print(ans)

else:

    print((-1))

import numpy as np

N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
    Ci, *A = list(map(int, input().split()))
    CA.append((Ci, A))
ans = 10**8
studied = np.array([0] * M)
for i in range(2**N):
    flag = True
    tmp_ans = 0
    studied = np.array([0] * M)
    for j in range(N):
        if i >> j & 1:
            tmp_ans += CA[j][0]
            studied += CA[j][1]
    for study in studied:
        if study < X:
            flag = False
            break
    if flag:
        ans = min(ans, tmp_ans)
if ans == 10**8:
    print((-1))
else:
    print(ans)

N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
    C, *A = list(map(int, input().split()))
    CA.append((C, A))
ans = 10**9
for i in range(2**N):
    flag = True
    tmp_C = 0
    tmp_A = [0] * M
    for j in range(N):
        if i >> j & 1:
            tmp_C += CA[j][0]
            for k in range(M):
                tmp_A[k] += CA[j][1][k]
    for tmp_a in tmp_A:
        if tmp_a < X:
            flag = False
            break
    if flag == True:
        ans = min(ans, tmp_C)
if ans < 10**9:
    print(ans)
else:
    print((-1))

-import numpy as np - -    Ci, *A = list(map(int, input().split())) -    CA.append((Ci, A)) -ans = 10**8 -studied = np.array([0] * M) +    C, *A = list(map(int, input().split())) +    CA.append((C, A)) +ans = 10**9 -    tmp_ans = 0 -    studied = np.array([0] * M) +    tmp_C = 0 +    tmp_A = [0] * M -            tmp_ans += CA[j][0] -            studied += CA[j][1] -    for study in studied: -        if study < X: +            tmp_C += CA[j][0] +            for k in range(M): +                tmp_A[k] += CA[j][1][k] +    for tmp_a in tmp_A: +        if tmp_a < X: -    if flag: -        ans = min(ans, tmp_ans) -if ans == 10**8: +    if flag == True: +        ans = min(ans, tmp_C) +if ans < 10**9: +    print(ans) +else: -else: -    print(ans)