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

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

S=[[0 for _ in range(M)] for _ in range(2**N)]

cost=[]



for i in range(2**N):

    b=bin(i)[2:].zfill(N)

    t_cost=0

    for j in range(N):

        t_cost+=A[j][0]*int(b[j])

        for m in range(M):

            S[i][m]+=A[j][m+1]*int(b[j])

    

    if min(S[i])>=X:

        cost.append(t_cost)



if len(cost)==0:

    print((-1))

else:

    print((min(cost)))
def dfs(bit):

    if len(bit)==N:

        c=0

        s=[0 for _ in range(M)]

        for i in range(N):

            c+=A[i][0]*bit[i]

            if bit[i]==1:

                for j in range(M):

                    s[j]+=A[i][j+1]

                cond=True

                for k in range(M):

                    if s[k]<X:

                        cond=False

                        break

                if cond:

                    ans.append(c)

        return



    else:

        for i in range(2):

            bit.append(i)

            dfs(bit)

            bit.pop()

    

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

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



ans=[]



dfs([])



if len(ans)==0:

    print((-1))

else:

    print((min(ans)))
N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
S = [[0 for _ in range(M)] for _ in range(2**N)]
cost = []
for i in range(2**N):
    b = bin(i)[2:].zfill(N)
    t_cost = 0
    for j in range(N):
        t_cost += A[j][0] * int(b[j])
        for m in range(M):
            S[i][m] += A[j][m + 1] * int(b[j])
    if min(S[i]) >= X:
        cost.append(t_cost)
if len(cost) == 0:
    print((-1))
else:
    print((min(cost)))

def dfs(bit):
    if len(bit) == N:
        c = 0
        s = [0 for _ in range(M)]
        for i in range(N):
            c += A[i][0] * bit[i]
            if bit[i] == 1:
                for j in range(M):
                    s[j] += A[i][j + 1]
                cond = True
                for k in range(M):
                    if s[k] < X:
                        cond = False
                        break
                if cond:
                    ans.append(c)
        return
    else:
        for i in range(2):
            bit.append(i)
            dfs(bit)
            bit.pop()


N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = []
dfs([])
if len(ans) == 0:
    print((-1))
else:
    print((min(ans)))

+def dfs(bit): +    if len(bit) == N: +        c = 0 +        s = [0 for _ in range(M)] +        for i in range(N): +            c += A[i][0] * bit[i] +            if bit[i] == 1: +                for j in range(M): +                    s[j] += A[i][j + 1] +                cond = True +                for k in range(M): +                    if s[k] < X: +                        cond = False +                        break +                if cond: +                    ans.append(c) +        return +    else: +        for i in range(2): +            bit.append(i) +            dfs(bit) +            bit.pop() + + -S = [[0 for _ in range(M)] for _ in range(2**N)] -cost = [] -for i in range(2**N): -    b = bin(i)[2:].zfill(N) -    t_cost = 0 -    for j in range(N): -        t_cost += A[j][0] * int(b[j]) -        for m in range(M): -            S[i][m] += A[j][m + 1] * int(b[j]) -    if min(S[i]) >= X: -        cost.append(t_cost) -if len(cost) == 0: +ans = [] +dfs([]) +if len(ans) == 0: -    print((min(cost))) +    print((min(ans)))