from itertools import combinations

import numpy as np

import sys

input   = sys.stdin.readline

        #買う本

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

C_np    = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)

all_book= [i for i in range(N)]  

flag    =False

price_list  =[]

#C_np        =np.array(C,dtype=int)

price       =C_np[:,0]

understand  =np.delete(C_np,0,1)

for num in range(1,N+1): #1冊からN冊まで

    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙

        book_buy        =np.array(t,dtype=int) 

        understand_now  = understand[book_buy] 

        understand_sum  = np.sum(understand_now, axis=0)

        if np.all(understand_sum >= X):

            price_now =price[book_buy]

            price_list.append(np.sum(price_now))

            flag =True

if flag ==True:

    print((min(price_list)))

else:

    print((-1))
# 初期入力

from itertools import combinations

from itertools import product

import numpy as np 

import sys

input   = sys.stdin.readline

N,M,X   = (int(x) for x in input().split())

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

all_book= [i for i in range(N)]          #買う本



price_list  =[]

flag        =False

C_np        =np.array(C,dtype=int)

price       =C_np[:,0]

understand  =np.delete(C_np,0,1)



for num in range(1,N+1): #1冊からN冊まで

    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙

        book_buy         =np.array(t,dtype=int)      #今回買った本

        understand_now   =understand[book_buy]       #買ったうちの各本の知識

        understand_sum   =np.sum(understand_now,axis=0) #知識の合計



        if np.all(X <= understand_sum ): #アルゴリズム理解度が全て目標値X以上か

            price_now =price[book_buy]

            price_list.append(np.sum(price_now))

            flag =True

if flag ==True:

    print((min(price_list)))

else:

    print((-1))
from itertools import combinations
import numpy as np
import sys

input = sys.stdin.readline
# 買う本
N, M, X = list(map(int, input().split()))
C_np = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)
all_book = [i for i in range(N)]
flag = False
price_list = []
# C_np        =np.array(C,dtype=int)
price = C_np[:, 0]
understand = np.delete(C_np, 0, 1)
for num in range(1, N + 1):  # 1冊からN冊まで
    for t in combinations(all_book, num):  # 参考書を買う組合せ、全列挙
        book_buy = np.array(t, dtype=int)
        understand_now = understand[book_buy]
        understand_sum = np.sum(understand_now, axis=0)
        if np.all(understand_sum >= X):
            price_now = price[book_buy]
            price_list.append(np.sum(price_now))
            flag = True
if flag == True:
    print((min(price_list)))
else:
    print((-1))

# 初期入力
from itertools import combinations
from itertools import product
import numpy as np
import sys

input = sys.stdin.readline
N, M, X = (int(x) for x in input().split())
C = [list(map(int, input().split())) for i in range(N)]
all_book = [i for i in range(N)]  # 買う本
price_list = []
flag = False
C_np = np.array(C, dtype=int)
price = C_np[:, 0]
understand = np.delete(C_np, 0, 1)
for num in range(1, N + 1):  # 1冊からN冊まで
    for t in combinations(all_book, num):  # 参考書を買う組合せ、全列挙
        book_buy = np.array(t, dtype=int)  # 今回買った本
        understand_now = understand[book_buy]  # 買ったうちの各本の知識
        understand_sum = np.sum(understand_now, axis=0)  # 知識の合計
        if np.all(X <= understand_sum):  # アルゴリズム理解度が全て目標値X以上か
            price_now = price[book_buy]
            price_list.append(np.sum(price_now))
            flag = True
if flag == True:
    print((min(price_list)))
else:
    print((-1))

+# 初期入力 +from itertools import product -# 買う本 -N, M, X = list(map(int, input().split())) -C_np = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int) -all_book = [i for i in range(N)] +N, M, X = (int(x) for x in input().split()) +C = [list(map(int, input().split())) for i in range(N)] +all_book = [i for i in range(N)]  # 買う本 +price_list = [] -price_list = [] -# C_np        =np.array(C,dtype=int) +C_np = np.array(C, dtype=int) -        book_buy = np.array(t, dtype=int) -        understand_now = understand[book_buy] -        understand_sum = np.sum(understand_now, axis=0) -        if np.all(understand_sum >= X): +        book_buy = np.array(t, dtype=int)  # 今回買った本 +        understand_now = understand[book_buy]  # 買ったうちの各本の知識 +        understand_sum = np.sum(understand_now, axis=0)  # 知識の合計 +        if np.all(X <= understand_sum):  # アルゴリズム理解度が全て目標値X以上か