import numpy as np

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

C = []

A = []

for i in range(N):

    c = 0

    a = []

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

    C.append(c)

    A.append(a)

A = np.array(A)

inf = float("inf")

res = inf

for bit in range(1 << N):

    Cost = 0

    Wise = np.zeros(M)

    for i in range(N):

        if (bit >> i) & 1:# i冊目を買うときの処理

            Cost += C[i]

            Wise += A[i]

            Wise = Wise.tolist()

            #else:# i冊目を買わないときの処理（今回は何もしないので省略）

    if min(Wise) >= X and Cost <= res:

        res = Cost

if res == inf:

    print("-1")

else:

    print(res)















"""

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

c=[]

a=[]

INF = float("inf")

stock = INF

for _  in range(n):

    c_temp,*a_temp = list(map(int,input().split()))

    c.append(c_temp)

    a.append(a_temp)



#すべての組み合わせを計算



for bit in range(1 << n):

    cost_total = 0

    smart_total = [0]*m

    #１セットごとの処理

    for i in range(n):

        #一冊ごとの処理

        if (bit >> i) & 1:

            # i冊目を買うときの処理

            smart = []

            cost_total += c[i]

            smart = a[i]

            for j , sm in enumerate(smart):

                smart_total[j] += sm

        #else:

            # i冊目を買わないときの処理（今回は何もしないので省略）

    judege = True

    for i in range(m):

        if smart_total[i] < x:

            judege = False

    if judege:

        stock = min(cost_total,stock)

if stock == INF:

    print("-1")

else:

    print(stock)"""
import numpy as np

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

C = []

A = []

for i in range(N):

    c = 0

    a = []

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

    C.append(c)

    A.append(a)

inf = float("inf")

res = inf

for bit in range(1 << N):

    Cost = 0

    Wise = [0] * M

    for i in range(N):

        if (bit >> i) & 1:# i冊目を買うときの処理

            Cost += C[i]

            for j, a in enumerate(A[i]):

                Wise[j] += a

            #else:# i冊目を買わないときの処理（今回は何もしないので省略）

    if min(Wise) >= X and Cost <= res:

        res = Cost

if res == inf:

    print("-1")

else:

    print(res)

import numpy as np

N, M, X = list(map(int, input().split()))
C = []
A = []
for i in range(N):
    c = 0
    a = []
    c, *a = list(map(int, input().split()))
    C.append(c)
    A.append(a)
A = np.array(A)
inf = float("inf")
res = inf
for bit in range(1 << N):
    Cost = 0
    Wise = np.zeros(M)
    for i in range(N):
        if (bit >> i) & 1:  # i冊目を買うときの処理
            Cost += C[i]
            Wise += A[i]
            Wise = Wise.tolist()
            # else:# i冊目を買わないときの処理（今回は何もしないので省略）
    if min(Wise) >= X and Cost <= res:
        res = Cost
if res == inf:
    print("-1")
else:
    print(res)
"""
n,m,x = map(int,input().split())
c=[]
a=[]
INF = float("inf")
stock = INF
for _  in range(n):
    c_temp,*a_temp = list(map(int,input().split()))
    c.append(c_temp)
    a.append(a_temp)
#すべての組み合わせを計算
for bit in range(1 << n):
    cost_total = 0
    smart_total = [0]*m
    #１セットごとの処理
    for i in range(n):
        #一冊ごとの処理
        if (bit >> i) & 1:
            # i冊目を買うときの処理
            smart = []
            cost_total += c[i]
            smart = a[i]
            for j , sm in enumerate(smart):
                smart_total[j] += sm
        #else:
            # i冊目を買わないときの処理（今回は何もしないので省略）
    judege = True
    for i in range(m):
        if smart_total[i] < x:
            judege = False
    if judege:
        stock = min(cost_total,stock)
if stock == INF:
    print("-1")
else:
    print(stock)"""

import numpy as np

N, M, X = list(map(int, input().split()))
C = []
A = []
for i in range(N):
    c = 0
    a = []
    c, *a = list(map(int, input().split()))
    C.append(c)
    A.append(a)
inf = float("inf")
res = inf
for bit in range(1 << N):
    Cost = 0
    Wise = [0] * M
    for i in range(N):
        if (bit >> i) & 1:  # i冊目を買うときの処理
            Cost += C[i]
            for j, a in enumerate(A[i]):
                Wise[j] += a
            # else:# i冊目を買わないときの処理（今回は何もしないので省略）
    if min(Wise) >= X and Cost <= res:
        res = Cost
if res == inf:
    print("-1")
else:
    print(res)

-A = np.array(A) -    Wise = np.zeros(M) +    Wise = [0] * M -            Wise += A[i] -            Wise = Wise.tolist() +            for j, a in enumerate(A[i]): +                Wise[j] += a -""" -n,m,x = map(int,input().split()) -c=[] -a=[] -INF = float("inf") -stock = INF -for _  in range(n): -    c_temp,*a_temp = list(map(int,input().split())) -    c.append(c_temp) -    a.append(a_temp) -#すべての組み合わせを計算 -for bit in range(1 << n): -    cost_total = 0 -    smart_total = [0]*m -    #１セットごとの処理 -    for i in range(n): -        #一冊ごとの処理 -        if (bit >> i) & 1: -            # i冊目を買うときの処理 -            smart = [] -            cost_total += c[i] -            smart = a[i] -            for j , sm in enumerate(smart): -                smart_total[j] += sm -        #else: -            # i冊目を買わないときの処理（今回は何もしないので省略） -    judege = True -    for i in range(m): -        if smart_total[i] < x: -            judege = False -    if judege: -        stock = min(cost_total,stock) -if stock == INF: -    print("-1") -else: -    print(stock)"""