from sys import stdin

input = stdin.readline



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

pricelist = [0] * N

matrix = [[0] * M for _ in range(N)]

for i in range(N):

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

    pricelist[i] = row.pop(0)

    matrix[i] = row



mintotalprice = 10**5 * 12 + 1

for bit in range(2**N):

    flag = True

    for j in range(M):

        totalscore = 0

        for i in range(N):

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

                totalscore += matrix[i][j]

        if totalscore < X:

            flag = False

            break

    if flag:

        totalprice = 0

        for i in range(N):

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

                totalprice += pricelist[i]

        mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice

        

print((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1))
N,M,X = list(map(int, input().split()))

C = [0]*N

A = [[[0]*M] for i in range(N)]

for i in range(N):

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

MAX = 10**5 * 12 + 1

minprice = MAX

for b in range(2**N):

    abilityList = [0]*M

    price = 0

    for i in range(N):

        if b >> i & 1 == 1:

            abilityList = [x+y for (x,y) in zip(abilityList, A[i])]

            price += C[i]

    judge = True

    for ability in abilityList:

        if ability < X:

            judge = False

    if judge:

        minprice = min(minprice, price)

ans = minprice if minprice != MAX else -1

print(ans)
from sys import stdin

input = stdin.readline
N, M, X = list(map(int, input().split()))
pricelist = [0] * N
matrix = [[0] * M for _ in range(N)]
for i in range(N):
    row = list(map(int, input().split()))
    pricelist[i] = row.pop(0)
    matrix[i] = row
mintotalprice = 10**5 * 12 + 1
for bit in range(2**N):
    flag = True
    for j in range(M):
        totalscore = 0
        for i in range(N):
            if (bit >> i & 1) == 1:
                totalscore += matrix[i][j]
        if totalscore < X:
            flag = False
            break
    if flag:
        totalprice = 0
        for i in range(N):
            if (bit >> i & 1) == 1:
                totalprice += pricelist[i]
        mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice
print((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1))

N, M, X = list(map(int, input().split()))
C = [0] * N
A = [[[0] * M] for i in range(N)]
for i in range(N):
    C[i], *A[i] = list(map(int, input().split()))
MAX = 10**5 * 12 + 1
minprice = MAX
for b in range(2**N):
    abilityList = [0] * M
    price = 0
    for i in range(N):
        if b >> i & 1 == 1:
            abilityList = [x + y for (x, y) in zip(abilityList, A[i])]
            price += C[i]
    judge = True
    for ability in abilityList:
        if ability < X:
            judge = False
    if judge:
        minprice = min(minprice, price)
ans = minprice if minprice != MAX else -1
print(ans)

-from sys import stdin - -input = stdin.readline -pricelist = [0] * N -matrix = [[0] * M for _ in range(N)] +C = [0] * N +A = [[[0] * M] for i in range(N)] -    row = list(map(int, input().split())) -    pricelist[i] = row.pop(0) -    matrix[i] = row -mintotalprice = 10**5 * 12 + 1 -for bit in range(2**N): -    flag = True -    for j in range(M): -        totalscore = 0 -        for i in range(N): -            if (bit >> i & 1) == 1: -                totalscore += matrix[i][j] -        if totalscore < X: -            flag = False -            break -    if flag: -        totalprice = 0 -        for i in range(N): -            if (bit >> i & 1) == 1: -                totalprice += pricelist[i] -        mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice -print((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1)) +    C[i], *A[i] = list(map(int, input().split())) +MAX = 10**5 * 12 + 1 +minprice = MAX +for b in range(2**N): +    abilityList = [0] * M +    price = 0 +    for i in range(N): +        if b >> i & 1 == 1: +            abilityList = [x + y for (x, y) in zip(abilityList, A[i])] +            price += C[i] +    judge = True +    for ability in abilityList: +        if ability < X: +            judge = False +    if judge: +        minprice = min(minprice, price) +ans = minprice if minprice != MAX else -1 +print(ans)