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:].T



ans = INF

for p_li in product([1, 0], repeat=n):

    p = np.array(p_li)

    rikai = a * p

    sm = rikai.sum(axis=1)

    if sm.min() >= x:

        cost = (c * p).sum()

        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)

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:].T
ans = INF
for p_li in product([1, 0], repeat=n):
    p = np.array(p_li)
    rikai = a * p
    sm = rikai.sum(axis=1)
    if sm.min() >= x:
        cost = (c * p).sum()
        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)

-a = ca[:, 1:].T -ans = INF -for p_li in product([1, 0], repeat=n): -    p = np.array(p_li) -    rikai = a * p -    sm = rikai.sum(axis=1) -    if sm.min() >= x: -        cost = (c * p).sum() -        ans = min(ans, cost) -if ans == INF: +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: