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

CAAA = [input().split() for i in range(N)]



ans=100000000000



for i in range(1, 2**N):

  price=0

  rikaido = [0]*M

  for j in range(N):

    if i>>j & 1:

      price += int(CAAA[j][0])

      for k in range(M):

        rikaido[k] += int(CAAA[j][k+1])

        for l in rikaido:

          if l < X:

            break

        else:

          ans = min(ans, price)

if ans == 100000000000:

  print((-1))

else:

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

CAAA = [input().split() for i in range(N)]



ans=100000000000



for i in range(1, 2**N):

  price=0

  rikaido = [0]*M

  for j in range(N):

    if i>>j & 1:

      price += int(CAAA[j][0])

      for k in range(M):

        rikaido[k] += int(CAAA[j][k+1])

  for l in rikaido:

    if l < X:

      break

  else:

    ans = min(ans, price)

if ans == 100000000000:

  print((-1))

else:

  print(ans)

    
N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans = 100000000000
for i in range(1, 2**N):
    price = 0
    rikaido = [0] * M
    for j in range(N):
        if i >> j & 1:
            price += int(CAAA[j][0])
            for k in range(M):
                rikaido[k] += int(CAAA[j][k + 1])
                for l in rikaido:
                    if l < X:
                        break
                else:
                    ans = min(ans, price)
if ans == 100000000000:
    print((-1))
else:
    print(ans)

N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans = 100000000000
for i in range(1, 2**N):
    price = 0
    rikaido = [0] * M
    for j in range(N):
        if i >> j & 1:
            price += int(CAAA[j][0])
            for k in range(M):
                rikaido[k] += int(CAAA[j][k + 1])
    for l in rikaido:
        if l < X:
            break
    else:
        ans = min(ans, price)
if ans == 100000000000:
    print((-1))
else:
    print(ans)

-                for l in rikaido: -                    if l < X: -                        break -                else: -                    ans = min(ans, price) +    for l in rikaido: +        if l < X: +            break +    else: +        ans = min(ans, price)