# ビット全探索版

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

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



ans = []

for i in range(2**n):

  price = 0

  und = [0 for _ in range(m)]

  for j in range(n):

    if (i >> j) & 1:

      price += c[j][0]

      for k in range(m):

        und[k] += c[j][k+1]

  if all(und[i] >= x for i in range(m)):

    ans.append(price)

    

if ans == []:

  print((-1))

else:

  print((min(ans)))
from itertools import combinations

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

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



ans = 10**9

for i in range(1, n+1):

  for j in combinations(ca,i):

    t = [0]*(m+1)

    for k in j:

      for l in range(m+1):

        t[l] += k[l]

    #if all(t[num] >= x for num in range(1,m)):

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

      ans = min(ans, t[0])



if ans == 10**9:

  print((-1))

else:

  print(ans)
# ビット全探索版
n, m, x = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(n)]
ans = []
for i in range(2**n):
    price = 0
    und = [0 for _ in range(m)]
    for j in range(n):
        if (i >> j) & 1:
            price += c[j][0]
            for k in range(m):
                und[k] += c[j][k + 1]
    if all(und[i] >= x for i in range(m)):
        ans.append(price)
if ans == []:
    print((-1))
else:
    print((min(ans)))

from itertools import combinations

n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
ans = 10**9
for i in range(1, n + 1):
    for j in combinations(ca, i):
        t = [0] * (m + 1)
        for k in j:
            for l in range(m + 1):
                t[l] += k[l]
        # if all(t[num] >= x for num in range(1,m)):
        if min(t[1:]) >= x:
            ans = min(ans, t[0])
if ans == 10**9:
    print((-1))
else:
    print(ans)

-# ビット全探索版 +from itertools import combinations + -c = [list(map(int, input().split())) for _ in range(n)] -ans = [] -for i in range(2**n): -    price = 0 -    und = [0 for _ in range(m)] -    for j in range(n): -        if (i >> j) & 1: -            price += c[j][0] -            for k in range(m): -                und[k] += c[j][k + 1] -    if all(und[i] >= x for i in range(m)): -        ans.append(price) -if ans == []: +ca = [list(map(int, input().split())) for _ in range(n)] +ans = 10**9 +for i in range(1, n + 1): +    for j in combinations(ca, i): +        t = [0] * (m + 1) +        for k in j: +            for l in range(m + 1): +                t[l] += k[l] +        # if all(t[num] >= x for num in range(1,m)): +        if min(t[1:]) >= x: +            ans = min(ans, t[0]) +if ans == 10**9: -    print((min(ans))) +    print(ans)