N,M,X=list(map(int,input().split()))

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

ans=float("inf")

for i in range(2**N):

  price=0

  abil=[0]*M

  for j in range(N):

    if (i>>j)&1:

      price+=li[j][0]

      for k in range(1,M+1):

        abil[k-1]+=li[j][k]

  if min(abil)>=X:

    ans=min(ans,price)

if ans==float("inf"):

  print((-1))

else:

  print(ans)

N,M,X=list(map(int,input().split()))

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

ans=float("inf")

for i in range(2**N):

  PriceAbil=[0]*(M+1)

  for j in range(N):

    if (i>>j)&1:

      PriceAbil=[x+y for (x,y) in zip(PriceAbil,li[j])]

  if min(PriceAbil[1:])>=X:

    ans=min(ans,PriceAbil[0])

if ans==float("inf"):

  print((-1))

else:

  print(ans)
N, M, X = list(map(int, input().split()))
li = [list(map(int, input().split())) for _ in range(N)]
ans = float("inf")
for i in range(2**N):
    price = 0
    abil = [0] * M
    for j in range(N):
        if (i >> j) & 1:
            price += li[j][0]
            for k in range(1, M + 1):
                abil[k - 1] += li[j][k]
    if min(abil) >= X:
        ans = min(ans, price)
if ans == float("inf"):
    print((-1))
else:
    print(ans)

N, M, X = list(map(int, input().split()))
li = [list(map(int, input().split())) for _ in range(N)]
ans = float("inf")
for i in range(2**N):
    PriceAbil = [0] * (M + 1)
    for j in range(N):
        if (i >> j) & 1:
            PriceAbil = [x + y for (x, y) in zip(PriceAbil, li[j])]
    if min(PriceAbil[1:]) >= X:
        ans = min(ans, PriceAbil[0])
if ans == float("inf"):
    print((-1))
else:
    print(ans)

-    price = 0 -    abil = [0] * M +    PriceAbil = [0] * (M + 1) -            price += li[j][0] -            for k in range(1, M + 1): -                abil[k - 1] += li[j][k] -    if min(abil) >= X: -        ans = min(ans, price) +            PriceAbil = [x + y for (x, y) in zip(PriceAbil, li[j])] +    if min(PriceAbil[1:]) >= X: +        ans = min(ans, PriceAbil[0])