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

import numpy as np

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



ans = 10**18

for i in range(1<<N):

    algo = np.array([0]*M)

    cost = 0

    for j in range(N):

        if (i>>j)&1:

            c, *al = books[j]

            al = np.array(al)

            algo += al

            cost += c

    if np.all(algo>=X):

        ans = min(ans, cost)



if ans!=10**18:

    print(ans)

else:

    print((-1))
import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



import numpy as np

N, M, X = mapint()

CAs = [list(mapint()) for _ in range(N)]



ans = 10**18

flg = False

for i in range(1<<N):

    tar = np.array([0]*M)

    m = 0

    for j in range(N):

        if (i>>j)&1:

            c, *As = CAs[j]

            tar += np.array(As)

            m += c

    if all(tar>=X):

        ans = min(ans, m)

        flg = True



if flg:

    print(ans)

else:

    print((-1))
N, M, X = list(map(int, input().split()))
import numpy as np

books = [list(map(int, input().split())) for _ in range(N)]
ans = 10**18
for i in range(1 << N):
    algo = np.array([0] * M)
    cost = 0
    for j in range(N):
        if (i >> j) & 1:
            c, *al = books[j]
            al = np.array(al)
            algo += al
            cost += c
    if np.all(algo >= X):
        ans = min(ans, cost)
if ans != 10**18:
    print(ans)
else:
    print((-1))

import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
import numpy as np

N, M, X = mapint()
CAs = [list(mapint()) for _ in range(N)]
ans = 10**18
flg = False
for i in range(1 << N):
    tar = np.array([0] * M)
    m = 0
    for j in range(N):
        if (i >> j) & 1:
            c, *As = CAs[j]
            tar += np.array(As)
            m += c
    if all(tar >= X):
        ans = min(ans, m)
        flg = True
if flg:
    print(ans)
else:
    print((-1))

-N, M, X = list(map(int, input().split())) +import sys + + +def input(): +    return sys.stdin.readline().strip() + + +def mapint(): +    return list(map(int, input().split())) + + +sys.setrecursionlimit(10**9) -books = [list(map(int, input().split())) for _ in range(N)] +N, M, X = mapint() +CAs = [list(mapint()) for _ in range(N)] +flg = False -    algo = np.array([0] * M) -    cost = 0 +    tar = np.array([0] * M) +    m = 0 -            c, *al = books[j] -            al = np.array(al) -            algo += al -            cost += c -    if np.all(algo >= X): -        ans = min(ans, cost) -if ans != 10**18: +            c, *As = CAs[j] +            tar += np.array(As) +            m += c +    if all(tar >= X): +        ans = min(ans, m) +        flg = True +if flg: