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

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

cost_list = []

for i in range(2**N):

  achive = [0]*M

  achive_list = [0]*M

  cost = 0

  for j in range(N):

    if ((i>>j)&1)==1:

      cost = cost + c_list[j][0]

      for k in range(M):

        achive[k] = achive[k] + c_list[j][k+1]

        if achive[k] >= X:

          achive_list[k] = -1

  if sum(achive_list) == -1*M:

    cost_list.append(cost)

print((min(cost_list) if cost_list else -1))
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(2**N):

  cost = 0

  skill = [0]*M

  cnt = 0

  for j in range(N):

    if (i>>j)&1 == 1:

      for k in range(M):

        skill[k] += CA[j][k+1]

      cost += CA[j][0]

  for l in range(M):

    if skill[l] >= X:

      cnt += 1

    if cnt == M:

      ans = min(ans,cost)

if ans == 10**9:

  print((-1))

else:

  print(ans)
N, M, X = list(map(int, input().split()))
c_list = [list(map(int, input().split())) for _ in range(N)]
cost_list = []
for i in range(2**N):
    achive = [0] * M
    achive_list = [0] * M
    cost = 0
    for j in range(N):
        if ((i >> j) & 1) == 1:
            cost = cost + c_list[j][0]
            for k in range(M):
                achive[k] = achive[k] + c_list[j][k + 1]
                if achive[k] >= X:
                    achive_list[k] = -1
    if sum(achive_list) == -1 * M:
        cost_list.append(cost)
print((min(cost_list) if cost_list else -1))

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(2**N):
    cost = 0
    skill = [0] * M
    cnt = 0
    for j in range(N):
        if (i >> j) & 1 == 1:
            for k in range(M):
                skill[k] += CA[j][k + 1]
            cost += CA[j][0]
    for l in range(M):
        if skill[l] >= X:
            cnt += 1
        if cnt == M:
            ans = min(ans, cost)
if ans == 10**9:
    print((-1))
else:
    print(ans)

-c_list = [list(map(int, input().split())) for _ in range(N)] -cost_list = [] +CA = [list(map(int, input().split())) for _ in range(N)] +ans = 10**9 -    achive = [0] * M -    achive_list = [0] * M +    skill = [0] * M +    cnt = 0 -        if ((i >> j) & 1) == 1: -            cost = cost + c_list[j][0] +        if (i >> j) & 1 == 1: -                achive[k] = achive[k] + c_list[j][k + 1] -                if achive[k] >= X: -                    achive_list[k] = -1 -    if sum(achive_list) == -1 * M: -        cost_list.append(cost) -print((min(cost_list) if cost_list else -1)) +                skill[k] += CA[j][k + 1] +            cost += CA[j][0] +    for l in range(M): +        if skill[l] >= X: +            cnt += 1 +        if cnt == M: +            ans = min(ans, cost) +if ans == 10**9: +    print((-1)) +else: +    print(ans)