import numpy as np

from itertools import product



inf = int(1e20)

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

_ = [[int(x) for x in input().split()] for _ in range(n)]

CA = np.array(_, dtype=int)

ans = inf

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

    tmp = np.zeros(m + 1, dtype=int)

    for idx, be_used in enumerate(indices):

        tmp += be_used * CA[idx]

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

        ans = min(ans, tmp[0])

print((ans if ans != inf else '-1'))

import numpy as np

from itertools import product



inf = int(1e20)

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

_ = [[int(x) for x in input().split()] for _ in range(n)]

CA = np.array(_, dtype=int)

ans = inf

for indices in product([False, True], repeat=n):

    sums = np.sum(CA[np.array(indices)], axis=0)

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

        ans = min(ans, sums[0])

print((ans if ans != inf else '-1'))

import numpy as np
from itertools import product

inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([0, 1], repeat=n):
    tmp = np.zeros(m + 1, dtype=int)
    for idx, be_used in enumerate(indices):
        tmp += be_used * CA[idx]
    if min(tmp[1:]) >= x:
        ans = min(ans, tmp[0])
print((ans if ans != inf else "-1"))

import numpy as np
from itertools import product

inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([False, True], repeat=n):
    sums = np.sum(CA[np.array(indices)], axis=0)
    if min(sums[1:]) >= x:
        ans = min(ans, sums[0])
print((ans if ans != inf else "-1"))

-for indices in product([0, 1], repeat=n): -    tmp = np.zeros(m + 1, dtype=int) -    for idx, be_used in enumerate(indices): -        tmp += be_used * CA[idx] -    if min(tmp[1:]) >= x: -        ans = min(ans, tmp[0]) +for indices in product([False, True], repeat=n): +    sums = np.sum(CA[np.array(indices)], axis=0) +    if min(sums[1:]) >= x: +        ans = min(ans, sums[0])