from itertools import combinations

import numpy as np

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

money_ls = [0] * n

ex_ls = [0] * n

for i in range(n):

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

    money_ls[i] = in_[0]

    ex_ls[i] = in_[1:]



min_money = float('inf')





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

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

    for inds in combinations(book_ls, num):

        res = True

        money = 0

        ex_now = [0] * m

        for ind in inds:

            money += money_ls[ind]

            for i in range(m):

                ex_now[i] += ex_ls[ind][i]

        for i in range(m):

            if ex_now[i] < x:

                res = False

        if res:

            min_money = min(money, min_money)

if min_money == float('inf'):

    min_money = -1

print(min_money)
n_book, n_algo, target = list(map(int,input().split()))

cost_ls = [0] * n_book

up_ls = [0] * n_book

for i in range(n_book):

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

    cost_ls[i] = ls[0]

    up_ls[i] = ls[1:]



n_pattern = 2 ** n_book

min_cost = float('inf')

for pattern in range(n_pattern):

    cost = 0

    score_ls = [0] * n_algo

    can = True

    for ind_book in range(n_book):

        if (pattern >> ind_book) & 1:

            cost += cost_ls[ind_book]

            for ind_algo in range(n_algo):

                score_ls[ind_algo] += up_ls[ind_book][ind_algo]

    for ind_algo in range(n_algo):

        if score_ls[ind_algo] < target:

            can = False

    if can:

        min_cost = min(min_cost, cost)

if min_cost == float('inf'):

    print((-1))

else:

    print(min_cost)





from itertools import combinations
import numpy as np

n, m, x = list(map(int, input().split()))
money_ls = [0] * n
ex_ls = [0] * n
for i in range(n):
    in_ = list(map(int, input().split()))
    money_ls[i] = in_[0]
    ex_ls[i] = in_[1:]
min_money = float("inf")
book_ls = [i for i in range(n)]
for num in range(1, n + 1):
    for inds in combinations(book_ls, num):
        res = True
        money = 0
        ex_now = [0] * m
        for ind in inds:
            money += money_ls[ind]
            for i in range(m):
                ex_now[i] += ex_ls[ind][i]
        for i in range(m):
            if ex_now[i] < x:
                res = False
        if res:
            min_money = min(money, min_money)
if min_money == float("inf"):
    min_money = -1
print(min_money)

n_book, n_algo, target = list(map(int, input().split()))
cost_ls = [0] * n_book
up_ls = [0] * n_book
for i in range(n_book):
    ls = list(map(int, input().split()))
    cost_ls[i] = ls[0]
    up_ls[i] = ls[1:]
n_pattern = 2**n_book
min_cost = float("inf")
for pattern in range(n_pattern):
    cost = 0
    score_ls = [0] * n_algo
    can = True
    for ind_book in range(n_book):
        if (pattern >> ind_book) & 1:
            cost += cost_ls[ind_book]
            for ind_algo in range(n_algo):
                score_ls[ind_algo] += up_ls[ind_book][ind_algo]
    for ind_algo in range(n_algo):
        if score_ls[ind_algo] < target:
            can = False
    if can:
        min_cost = min(min_cost, cost)
if min_cost == float("inf"):
    print((-1))
else:
    print(min_cost)

-from itertools import combinations -import numpy as np - -n, m, x = list(map(int, input().split())) -money_ls = [0] * n -ex_ls = [0] * n -for i in range(n): -    in_ = list(map(int, input().split())) -    money_ls[i] = in_[0] -    ex_ls[i] = in_[1:] -min_money = float("inf") -book_ls = [i for i in range(n)] -for num in range(1, n + 1): -    for inds in combinations(book_ls, num): -        res = True -        money = 0 -        ex_now = [0] * m -        for ind in inds: -            money += money_ls[ind] -            for i in range(m): -                ex_now[i] += ex_ls[ind][i] -        for i in range(m): -            if ex_now[i] < x: -                res = False -        if res: -            min_money = min(money, min_money) -if min_money == float("inf"): -    min_money = -1 -print(min_money) +n_book, n_algo, target = list(map(int, input().split())) +cost_ls = [0] * n_book +up_ls = [0] * n_book +for i in range(n_book): +    ls = list(map(int, input().split())) +    cost_ls[i] = ls[0] +    up_ls[i] = ls[1:] +n_pattern = 2**n_book +min_cost = float("inf") +for pattern in range(n_pattern): +    cost = 0 +    score_ls = [0] * n_algo +    can = True +    for ind_book in range(n_book): +        if (pattern >> ind_book) & 1: +            cost += cost_ls[ind_book] +            for ind_algo in range(n_algo): +                score_ls[ind_algo] += up_ls[ind_book][ind_algo] +    for ind_algo in range(n_algo): +        if score_ls[ind_algo] < target: +            can = False +    if can: +        min_cost = min(min_cost, cost) +if min_cost == float("inf"): +    print((-1)) +else: +    print(min_cost)