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

c=[0]*n

a=[0]*n

ans=10**10

for i in range(n):

  d,*b=list(map(int,input().split()))

  c[i]=d

  a[i]=b

import numpy as np

a=np.array(a)

from itertools import product

r=list(product([0,1],repeat=n))

for i in r:

  tmp=np.array([0]*m)

  cost=0

  for j,k in enumerate(i):

    tmp+=k*a[j]

    cost+=k*c[j]

  if all(tmp>=x):

    ans=min(ans,cost)

if ans>10**9:

  ans=-1

print(ans)
from itertools import product

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

c=[0]*n

a=[0]*n

INF=10**9

for i in range(n):

  d,*b=list(map(int,input().split()))

  c[i]=d

  a[i]=b

ans=INF

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

  u=[0]*m

  cost=0

  for i in range(n):

    cost+=c[i]*z[i]

    for j in range(m):

      u[j]+=a[i][j]*z[i]

  flg=True

  for j in range(m):

    if u[j]<x:

      flg=False

  if flg:

    ans=min(ans,cost)

if ans==INF:

  ans=-1

print(ans)
n, m, x = list(map(int, input().split()))
c = [0] * n
a = [0] * n
ans = 10**10
for i in range(n):
    d, *b = list(map(int, input().split()))
    c[i] = d
    a[i] = b
import numpy as np

a = np.array(a)
from itertools import product

r = list(product([0, 1], repeat=n))
for i in r:
    tmp = np.array([0] * m)
    cost = 0
    for j, k in enumerate(i):
        tmp += k * a[j]
        cost += k * c[j]
    if all(tmp >= x):
        ans = min(ans, cost)
if ans > 10**9:
    ans = -1
print(ans)

from itertools import product

n, m, x = list(map(int, input().split()))
c = [0] * n
a = [0] * n
INF = 10**9
for i in range(n):
    d, *b = list(map(int, input().split()))
    c[i] = d
    a[i] = b
ans = INF
for z in product([0, 1], repeat=n):
    u = [0] * m
    cost = 0
    for i in range(n):
        cost += c[i] * z[i]
        for j in range(m):
            u[j] += a[i][j] * z[i]
    flg = True
    for j in range(m):
        if u[j] < x:
            flg = False
    if flg:
        ans = min(ans, cost)
if ans == INF:
    ans = -1
print(ans)

+from itertools import product + -ans = 10**10 +INF = 10**9 -import numpy as np - -a = np.array(a) -from itertools import product - -r = list(product([0, 1], repeat=n)) -for i in r: -    tmp = np.array([0] * m) +ans = INF +for z in product([0, 1], repeat=n): +    u = [0] * m -    for j, k in enumerate(i): -        tmp += k * a[j] -        cost += k * c[j] -    if all(tmp >= x): +    for i in range(n): +        cost += c[i] * z[i] +        for j in range(m): +            u[j] += a[i][j] * z[i] +    flg = True +    for j in range(m): +        if u[j] < x: +            flg = False +    if flg: -if ans > 10**9: +if ans == INF: