def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

N,M,X=MI()

List=[]

for i in range(N):

  CA=LI()

  List.append(CA)

ans=-1

for i in range(1<<N):

  tmp=[0]*M

  cost=0

  for j in range(N):

    if 1&(i>>j):

      cost+=List[j][0]

      for k in range(M):

        tmp[k]+=List[j][k+1]

      if min(tmp)>=X:

        if ans==-1:

          ans=cost

        else:

          ans=min(ans,cost)

print(ans)      
def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

N,M,X=MI()

C=[]

A=[]

for i in range(N):

  L=LI()

  C.append(L[0])

  A.append(L[1:])

ans=-1

for i in range(1<<N):

  tmp=[0]*M

  cost=0

  for j in range(N):

    if 1&(i>>j):

      cost+=C[j]

      for m in range(M):

        tmp[m]+=A[j][m]

  if min(tmp)>=X:

    if ans==-1:

      ans=cost

    else:

      ans=min(ans,cost)

print(ans)
def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


N, M, X = MI()
List = []
for i in range(N):
    CA = LI()
    List.append(CA)
ans = -1
for i in range(1 << N):
    tmp = [0] * M
    cost = 0
    for j in range(N):
        if 1 & (i >> j):
            cost += List[j][0]
            for k in range(M):
                tmp[k] += List[j][k + 1]
            if min(tmp) >= X:
                if ans == -1:
                    ans = cost
                else:
                    ans = min(ans, cost)
print(ans)

def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


N, M, X = MI()
C = []
A = []
for i in range(N):
    L = LI()
    C.append(L[0])
    A.append(L[1:])
ans = -1
for i in range(1 << N):
    tmp = [0] * M
    cost = 0
    for j in range(N):
        if 1 & (i >> j):
            cost += C[j]
            for m in range(M):
                tmp[m] += A[j][m]
    if min(tmp) >= X:
        if ans == -1:
            ans = cost
        else:
            ans = min(ans, cost)
print(ans)

-List = [] +C = [] +A = [] -    CA = LI() -    List.append(CA) +    L = LI() +    C.append(L[0]) +    A.append(L[1:]) -            cost += List[j][0] -            for k in range(M): -                tmp[k] += List[j][k + 1] -            if min(tmp) >= X: -                if ans == -1: -                    ans = cost -                else: -                    ans = min(ans, cost) +            cost += C[j] +            for m in range(M): +                tmp[m] += A[j][m] +    if min(tmp) >= X: +        if ans == -1: +            ans = cost +        else: +            ans = min(ans, cost)