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

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

ans=float("inf")

for i in range(2**N):

    ruikei=[0]*M

    onedan=0

    for j in range(N):

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

            onedan+=CA[j][0]

            for k in range(1,M+1):

                ruikei[k-1]+=CA[j][k]

    #print(onedan)

    #print(ruikei)    

    kari=True    

    for j in ruikei:

        if j<X:

            kari=False

    if kari:

        ans=min(ans,onedan)

if ans==float("inf"):

    print((-1))

else:

    print(ans)

        

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

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

kotae=[]

def saiki(A):

    if len(A)==N:

        goukei=[0]*M

        onedan=0

        for i in range(N):

            if A[i]==1:

                for j in range(M):

                    goukei[j]+=CA[i][j+1]

                onedan+=CA[i][0]

        #print(goukei)

        if min(goukei)>=X:

            kotae.append(onedan)

        return

    for i in range(2):

        A.append(i)

        saiki(A)

        A.pop()

saiki([])

if len(kotae)==0:

    print((-1))

    exit()

print((min(kotae)))
N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
ans = float("inf")
for i in range(2**N):
    ruikei = [0] * M
    onedan = 0
    for j in range(N):
        if (i >> j) & 1:
            onedan += CA[j][0]
            for k in range(1, M + 1):
                ruikei[k - 1] += CA[j][k]
    # print(onedan)
    # print(ruikei)
    kari = True
    for j in ruikei:
        if j < X:
            kari = False
    if kari:
        ans = min(ans, onedan)
if ans == float("inf"):
    print((-1))
else:
    print(ans)

N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
kotae = []


def saiki(A):
    if len(A) == N:
        goukei = [0] * M
        onedan = 0
        for i in range(N):
            if A[i] == 1:
                for j in range(M):
                    goukei[j] += CA[i][j + 1]
                onedan += CA[i][0]
        # print(goukei)
        if min(goukei) >= X:
            kotae.append(onedan)
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()


saiki([])
if len(kotae) == 0:
    print((-1))
    exit()
print((min(kotae)))

-ans = float("inf") -for i in range(2**N): -    ruikei = [0] * M -    onedan = 0 -    for j in range(N): -        if (i >> j) & 1: -            onedan += CA[j][0] -            for k in range(1, M + 1): -                ruikei[k - 1] += CA[j][k] -    # print(onedan) -    # print(ruikei) -    kari = True -    for j in ruikei: -        if j < X: -            kari = False -    if kari: -        ans = min(ans, onedan) -if ans == float("inf"): +kotae = [] + + +def saiki(A): +    if len(A) == N: +        goukei = [0] * M +        onedan = 0 +        for i in range(N): +            if A[i] == 1: +                for j in range(M): +                    goukei[j] += CA[i][j + 1] +                onedan += CA[i][0] +        # print(goukei) +        if min(goukei) >= X: +            kotae.append(onedan) +        return +    for i in range(2): +        A.append(i) +        saiki(A) +        A.pop() + + +saiki([]) +if len(kotae) == 0: -else: -    print(ans) +    exit() +print((min(kotae)))