n,m,x = list(map(int,input().split()))

pattern = []

for i in range(2**(n)):

    tmp = [0 for i in range(n)]

    for j in range(n):

        if i>>j & 1:

            tmp[j] = 1

    pattern.append(tmp)



ans = 10**9

Input= []

for i in range(n):

    tmp = [int(i) for i in input().split()]

    Input.append(tmp)

for i in pattern:

    score = [0 for j in range(m)]

    tmp_ans = 0

    Flag = True

    for j in range(len(i)):

        if i[j]==0:

            continue

        else:

            tmp_ans += Input[j][0]

            for k in range(m):

                score[k] += Input[j][k+1]

    for k in range(m):

        if score[k]<x:

            Flag = False

    if Flag == False:

        continue

    ans = min(ans,tmp_ans)

if ans==10**9:

    print((-1))

else:

    print(ans)

def main():

    n,m,x = list(map(int,input().split()))

    A = []

    ans = 10**9

    for i in range(n):

        tmp = [int(i) for i in input().split()]

        A.append(tmp)

    for i in range(2**n):

        arg = [0 for j in range(m+1)]

        cost = 0

        for j in range(n):

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

                cost += A[j][0]

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

                    arg[k] += A[j][k]

        flag = True

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

            if arg[k]<x:

                flag = False

                break

        if flag:

            ans = min(ans,cost)

    if ans==10**9:

        print('-1')

    else:

        print(ans)

main()
n, m, x = list(map(int, input().split()))
pattern = []
for i in range(2 ** (n)):
    tmp = [0 for i in range(n)]
    for j in range(n):
        if i >> j & 1:
            tmp[j] = 1
    pattern.append(tmp)
ans = 10**9
Input = []
for i in range(n):
    tmp = [int(i) for i in input().split()]
    Input.append(tmp)
for i in pattern:
    score = [0 for j in range(m)]
    tmp_ans = 0
    Flag = True
    for j in range(len(i)):
        if i[j] == 0:
            continue
        else:
            tmp_ans += Input[j][0]
            for k in range(m):
                score[k] += Input[j][k + 1]
    for k in range(m):
        if score[k] < x:
            Flag = False
    if Flag == False:
        continue
    ans = min(ans, tmp_ans)
if ans == 10**9:
    print((-1))
else:
    print(ans)

def main():
    n, m, x = list(map(int, input().split()))
    A = []
    ans = 10**9
    for i in range(n):
        tmp = [int(i) for i in input().split()]
        A.append(tmp)
    for i in range(2**n):
        arg = [0 for j in range(m + 1)]
        cost = 0
        for j in range(n):
            if (i >> j) & 1 == 1:
                cost += A[j][0]
                for k in range(1, m + 1):
                    arg[k] += A[j][k]
        flag = True
        for k in range(1, m + 1):
            if arg[k] < x:
                flag = False
                break
        if flag:
            ans = min(ans, cost)
    if ans == 10**9:
        print("-1")
    else:
        print(ans)


main()

-n, m, x = list(map(int, input().split())) -pattern = [] -for i in range(2 ** (n)): -    tmp = [0 for i in range(n)] -    for j in range(n): -        if i >> j & 1: -            tmp[j] = 1 -    pattern.append(tmp) -ans = 10**9 -Input = [] -for i in range(n): -    tmp = [int(i) for i in input().split()] -    Input.append(tmp) -for i in pattern: -    score = [0 for j in range(m)] -    tmp_ans = 0 -    Flag = True -    for j in range(len(i)): -        if i[j] == 0: -            continue -        else: -            tmp_ans += Input[j][0] -            for k in range(m): -                score[k] += Input[j][k + 1] -    for k in range(m): -        if score[k] < x: -            Flag = False -    if Flag == False: -        continue -    ans = min(ans, tmp_ans) -if ans == 10**9: -    print((-1)) -else: -    print(ans) +def main(): +    n, m, x = list(map(int, input().split())) +    A = [] +    ans = 10**9 +    for i in range(n): +        tmp = [int(i) for i in input().split()] +        A.append(tmp) +    for i in range(2**n): +        arg = [0 for j in range(m + 1)] +        cost = 0 +        for j in range(n): +            if (i >> j) & 1 == 1: +                cost += A[j][0] +                for k in range(1, m + 1): +                    arg[k] += A[j][k] +        flag = True +        for k in range(1, m + 1): +            if arg[k] < x: +                flag = False +                break +        if flag: +            ans = min(ans, cost) +    if ans == 10**9: +        print("-1") +    else: +        print(ans) + + +main()