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

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



set_list = []

for i in range(2 ** N):

    select = []

    for j in range(N):

        if ((i >> j) & 1):

            select.append(j)

    if len(select) != 0:

        set_list.append(select)

    

cost = []

for i in range(2 ** N - 1):

    cost.append(sum([CA[set_list[i][j]][0] for j in range(len(set_list[i]))]))



skill = []

for i in range(2 ** N - 1):

    tmp = [0]*M

    for j in set_list[i]:

        for k in range(M):

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

    skill.append(tmp)



pool = []

for i in range(2**N - 1):

    flag = 0

    for j in skill[i]:

        if j < X:

            flag = 1

    if flag == 0:

        pool.append(cost[i])

        



if len(pool) == 0:

	print((-1))

else:

    print((min(pool)))

from itertools import combinations



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

C, A = [], []

for i in range(N):

    c, *a = list(map(int, input().split()))

    C.append(c)

    A.append(a)



ans = float('INF')

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

    for li in combinations(list(range(N)), i):

        cost = 0

        skill = [0] * M

        for j in li:

            cost += C[j]

            for k in range(M):

                skill[k] += A[j][k]

        if all([s >= X for s in skill]):

            ans = min(ans, cost)

if ans == float('INF'):

    print((-1))

else:

    print(ans)
N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
set_list = []
for i in range(2**N):
    select = []
    for j in range(N):
        if (i >> j) & 1:
            select.append(j)
    if len(select) != 0:
        set_list.append(select)
cost = []
for i in range(2**N - 1):
    cost.append(sum([CA[set_list[i][j]][0] for j in range(len(set_list[i]))]))
skill = []
for i in range(2**N - 1):
    tmp = [0] * M
    for j in set_list[i]:
        for k in range(M):
            tmp[k] += CA[j][k + 1]
    skill.append(tmp)
pool = []
for i in range(2**N - 1):
    flag = 0
    for j in skill[i]:
        if j < X:
            flag = 1
    if flag == 0:
        pool.append(cost[i])
if len(pool) == 0:
    print((-1))
else:
    print((min(pool)))

from itertools import combinations

N, M, X = list(map(int, input().split()))
C, A = [], []
for i in range(N):
    c, *a = list(map(int, input().split()))
    C.append(c)
    A.append(a)
ans = float("INF")
for i in range(1, N + 1):
    for li in combinations(list(range(N)), i):
        cost = 0
        skill = [0] * M
        for j in li:
            cost += C[j]
            for k in range(M):
                skill[k] += A[j][k]
        if all([s >= X for s in skill]):
            ans = min(ans, cost)
if ans == float("INF"):
    print((-1))
else:
    print(ans)

+from itertools import combinations + -CA = [list(map(int, input().split())) for i in range(N)] -set_list = [] -for i in range(2**N): -    select = [] -    for j in range(N): -        if (i >> j) & 1: -            select.append(j) -    if len(select) != 0: -        set_list.append(select) -cost = [] -for i in range(2**N - 1): -    cost.append(sum([CA[set_list[i][j]][0] for j in range(len(set_list[i]))])) -skill = [] -for i in range(2**N - 1): -    tmp = [0] * M -    for j in set_list[i]: -        for k in range(M): -            tmp[k] += CA[j][k + 1] -    skill.append(tmp) -pool = [] -for i in range(2**N - 1): -    flag = 0 -    for j in skill[i]: -        if j < X: -            flag = 1 -    if flag == 0: -        pool.append(cost[i]) -if len(pool) == 0: +C, A = [], [] +for i in range(N): +    c, *a = list(map(int, input().split())) +    C.append(c) +    A.append(a) +ans = float("INF") +for i in range(1, N + 1): +    for li in combinations(list(range(N)), i): +        cost = 0 +        skill = [0] * M +        for j in li: +            cost += C[j] +            for k in range(M): +                skill[k] += A[j][k] +        if all([s >= X for s in skill]): +            ans = min(ans, cost) +if ans == float("INF"): -    print((min(pool))) +    print(ans)