import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline



import numpy as np

from itertools import product



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

ca = np.array(read().split(), np.int64).reshape((n, m + 1))

INF = 10 ** 9



c = ca[:, 0]

a = ca[:, 1:]



p = np.array([e for e in product([1, 0], repeat=n)], np.int64)

rikai = np.dot(p, a)

cost = np.dot(p, c)

idx = rikai.min(axis=1) >= x

if idx.any():

    ans = cost[idx].min()

else:

    ans = -1



print(ans)

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

ca = [list(map(int, input().split())) for _ in range(n)]

INF = 10 ** 9



ans = INF

for i in range(1 << n):

    sm = [0] * m

    cost = 0

    for j in range(n):

        if i >> j & 1:

            cost += ca[j][0]

            for k, e in enumerate(ca[j][1:]):

                sm[k] += e



    if min(sm) >= x:

        ans = min(ans, cost)



if ans == INF:

    ans = -1



print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
import numpy as np
from itertools import product

n, m, x = list(map(int, readline().split()))
ca = np.array(read().split(), np.int64).reshape((n, m + 1))
INF = 10**9
c = ca[:, 0]
a = ca[:, 1:]
p = np.array([e for e in product([1, 0], repeat=n)], np.int64)
rikai = np.dot(p, a)
cost = np.dot(p, c)
idx = rikai.min(axis=1) >= x
if idx.any():
    ans = cost[idx].min()
else:
    ans = -1
print(ans)

n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
INF = 10**9
ans = INF
for i in range(1 << n):
    sm = [0] * m
    cost = 0
    for j in range(n):
        if i >> j & 1:
            cost += ca[j][0]
            for k, e in enumerate(ca[j][1:]):
                sm[k] += e
    if min(sm) >= x:
        ans = min(ans, cost)
if ans == INF:
    ans = -1
print(ans)

-import sys - -read = sys.stdin.buffer.read -readline = sys.stdin.buffer.readline -import numpy as np -from itertools import product - -n, m, x = list(map(int, readline().split())) -ca = np.array(read().split(), np.int64).reshape((n, m + 1)) +n, m, x = list(map(int, input().split())) +ca = [list(map(int, input().split())) for _ in range(n)] -c = ca[:, 0] -a = ca[:, 1:] -p = np.array([e for e in product([1, 0], repeat=n)], np.int64) -rikai = np.dot(p, a) -cost = np.dot(p, c) -idx = rikai.min(axis=1) >= x -if idx.any(): -    ans = cost[idx].min() -else: +ans = INF +for i in range(1 << n): +    sm = [0] * m +    cost = 0 +    for j in range(n): +        if i >> j & 1: +            cost += ca[j][0] +            for k, e in enumerate(ca[j][1:]): +                sm[k] += e +    if min(sm) >= x: +        ans = min(ans, cost) +if ans == INF: