import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



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

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



ans = float('inf')

# bit全探索

for i in range(2 ** n):

    bag = [0]*(m+1)

    for j in range(n):

        if ((i >> j) & 1):

            bag = [x + y for (x, y) in zip(bag, c[j])]

        if min(bag[1::]) >= x:

            ans = min(ans, bag[0])

            

print(('-1'if ans == float('inf') else int(ans)))

import itertools

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



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

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



ans = 10 ** 9 + 7

for l in list(itertools.product([0, 1], repeat=n)):

    cart = [0] * (m + 1)

    for i in [i for i, a in enumerate(l) if a == 1]:

        array = c[i]

        cart = list(map(lambda x,y: x+y, cart, array))

    if min(cart[1::]) >= x:

        ans = min(ans, cart[0])

        

print((ans if ans != 10 ** 9 + 7 else '-1'))
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n, m, x = list(map(int, readline().split()))
c = [list(map(int, readline().split())) for _ in range(n)]
ans = float("inf")
# bit全探索
for i in range(2**n):
    bag = [0] * (m + 1)
    for j in range(n):
        if (i >> j) & 1:
            bag = [x + y for (x, y) in zip(bag, c[j])]
        if min(bag[1::]) >= x:
            ans = min(ans, bag[0])
print(("-1" if ans == float("inf") else int(ans)))

import itertools
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n, m, x = list(map(int, readline().split()))
c = [list(map(int, readline().split())) for _ in range(n)]
ans = 10**9 + 7
for l in list(itertools.product([0, 1], repeat=n)):
    cart = [0] * (m + 1)
    for i in [i for i, a in enumerate(l) if a == 1]:
        array = c[i]
        cart = list(map(lambda x, y: x + y, cart, array))
    if min(cart[1::]) >= x:
        ans = min(ans, cart[0])
print((ans if ans != 10**9 + 7 else "-1"))

+import itertools -ans = float("inf") -# bit全探索 -for i in range(2**n): -    bag = [0] * (m + 1) -    for j in range(n): -        if (i >> j) & 1: -            bag = [x + y for (x, y) in zip(bag, c[j])] -        if min(bag[1::]) >= x: -            ans = min(ans, bag[0]) -print(("-1" if ans == float("inf") else int(ans))) +ans = 10**9 + 7 +for l in list(itertools.product([0, 1], repeat=n)): +    cart = [0] * (m + 1) +    for i in [i for i, a in enumerate(l) if a == 1]: +        array = c[i] +        cart = list(map(lambda x, y: x + y, cart, array)) +    if min(cart[1::]) >= x: +        ans = min(ans, cart[0]) +print((ans if ans != 10**9 + 7 else "-1"))