import sys

readline = sys.stdin.readline



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

data = [None] * N

for i in range(N):

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

  c = d[0]

  target = d[1:]

  data[i] = [c,target]



ans = 10 ** 9

for i in range(2 ** N):

  cost = 0

  skills = [0] * M

  for j in range(N):

    if (i >> j) & 1:

      cost += data[j][0]

      for k in range(len(data[j][1])):

        skills[k] += data[j][1][k]

  if ans > cost:

    for k in range(len(skills)):

      if skills[k] < X:

        break

    else:

      ans = cost

      

if ans == 10 ** 9:

  print((-1))

else:

  print(ans)
import sys

readline = sys.stdin.readline



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

books = [None] * N

for i in range(N):

  data = list(map(int,readline().split()))

  cost = data[0]

  point = data[1:]

  books[i] = [cost,point]

  

# M個から1個以上M個以下を選ぶ。選ぶ数でループ

INF = 10 ** 10

ans = INF

import itertools

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

  for target in itertools.combinations(books, i):

    skills = [0] * M

    totalcost = 0

    for t in target:

      totalcost += t[0]

      point = t[1]

      for j in range(len(point)):

        skills[j] += point[j]

    if totalcost < ans:

      for j in range(len(skills)):

        if skills[j] < X:

          break

      else:

        ans = totalcost

if ans == INF:

  print((-1))

else:

  print(ans)
import sys

readline = sys.stdin.readline
N, M, X = list(map(int, readline().split()))
data = [None] * N
for i in range(N):
    d = list(map(int, input().split()))
    c = d[0]
    target = d[1:]
    data[i] = [c, target]
ans = 10**9
for i in range(2**N):
    cost = 0
    skills = [0] * M
    for j in range(N):
        if (i >> j) & 1:
            cost += data[j][0]
            for k in range(len(data[j][1])):
                skills[k] += data[j][1][k]
    if ans > cost:
        for k in range(len(skills)):
            if skills[k] < X:
                break
        else:
            ans = cost
if ans == 10**9:
    print((-1))
else:
    print(ans)

import sys

readline = sys.stdin.readline
N, M, X = list(map(int, readline().split()))
books = [None] * N
for i in range(N):
    data = list(map(int, readline().split()))
    cost = data[0]
    point = data[1:]
    books[i] = [cost, point]
# M個から1個以上M個以下を選ぶ。選ぶ数でループ
INF = 10**10
ans = INF
import itertools

for i in range(1, N + 1):
    for target in itertools.combinations(books, i):
        skills = [0] * M
        totalcost = 0
        for t in target:
            totalcost += t[0]
            point = t[1]
            for j in range(len(point)):
                skills[j] += point[j]
        if totalcost < ans:
            for j in range(len(skills)):
                if skills[j] < X:
                    break
            else:
                ans = totalcost
if ans == INF:
    print((-1))
else:
    print(ans)

-data = [None] * N +books = [None] * N -    d = list(map(int, input().split())) -    c = d[0] -    target = d[1:] -    data[i] = [c, target] -ans = 10**9 -for i in range(2**N): -    cost = 0 -    skills = [0] * M -    for j in range(N): -        if (i >> j) & 1: -            cost += data[j][0] -            for k in range(len(data[j][1])): -                skills[k] += data[j][1][k] -    if ans > cost: -        for k in range(len(skills)): -            if skills[k] < X: -                break -        else: -            ans = cost -if ans == 10**9: +    data = list(map(int, readline().split())) +    cost = data[0] +    point = data[1:] +    books[i] = [cost, point] +# M個から1個以上M個以下を選ぶ。選ぶ数でループ +INF = 10**10 +ans = INF +import itertools + +for i in range(1, N + 1): +    for target in itertools.combinations(books, i): +        skills = [0] * M +        totalcost = 0 +        for t in target: +            totalcost += t[0] +            point = t[1] +            for j in range(len(point)): +                skills[j] += point[j] +        if totalcost < ans: +            for j in range(len(skills)): +                if skills[j] < X: +                    break +            else: +                ans = totalcost +if ans == INF: