import numpy as np

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 = np.empty(m+1)

    total = 0

    for j in range(n):

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

            bag += np.array(c[j])

        if np.amin(bag[1::]) >= x:

            ans = min(ans, bag[0])

            

print(('-1'if ans == float('inf') else int(ans)))
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 numpy as np
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 = np.empty(m + 1)
    total = 0
    for j in range(n):
        if (i >> j) & 1:
            bag += np.array(c[j])
        if np.amin(bag[1::]) >= x:
            ans = min(ans, bag[0])
print(("-1" if ans == float("inf") else int(ans)))

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 numpy as np -    bag = np.empty(m + 1) -    total = 0 +    bag = [0] * (m + 1) -            bag += np.array(c[j]) -        if np.amin(bag[1::]) >= x: +            bag = [x + y for (x, y) in zip(bag, c[j])] +        if min(bag[1::]) >= x: