import itertools

import math

import fractions

import functools



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



a_do = []

for i in range(n):

    a = list(map(int, input().split()))

    a_do.append(a)





nums = []

for i in range(n):

    nums.append(i)

minimum = 10**20



temp = []

for i in range(1, n+1):

    for v in itertools.combinations(nums, i): #参考書の選び方

        rikaido = [0] * (m+1)

        for j in range(len(v)):

            for k in range(m+1):

                rikaido[k] += a_do[v[j]][k]



        ok = True

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

            if rikaido[j] < x:

                ok = False

        if(ok):

            minimum = min(minimum, rikaido[0])



#         temp.append(rikaido)



# minimum = 10**20

# for i in range(len(temp)):

#     for j in range(1, m+1):

#         if temp[i][j] < x:

#             break

#         minimum = min(minimum, temp[i][0])



if(minimum == 10**20):

    print((-1))

else:

    print(minimum)

import itertools

import math

import fractions

import functools



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



a_do = []

for i in range(n):

    a = list(map(int, input().split()))

    a_do.append(a)





nums = []

for i in range(n):

    nums.append(i)



temp = []

for i in range(1, n+1):

    for v in itertools.combinations(nums, i):

        rikaido = [0] * (m+1)

        for j in range(len(v)):

            for k in range(m+1):

                rikaido[k] += a_do[v[j]][k]



        temp.append(rikaido)



minimum = 10**20

for i in range(len(temp)):

    ok = True

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

        if temp[i][j] < x:

            ok = False

    if(ok):

        minimum = min(minimum, temp[i][0])



if(minimum == 10**20):

    print((-1))

else:

    print(minimum)

import itertools
import math
import fractions
import functools

n, m, x = list(map(int, input().split()))
a_do = []
for i in range(n):
    a = list(map(int, input().split()))
    a_do.append(a)
nums = []
for i in range(n):
    nums.append(i)
minimum = 10**20
temp = []
for i in range(1, n + 1):
    for v in itertools.combinations(nums, i):  # 参考書の選び方
        rikaido = [0] * (m + 1)
        for j in range(len(v)):
            for k in range(m + 1):
                rikaido[k] += a_do[v[j]][k]
        ok = True
        for j in range(1, m + 1):
            if rikaido[j] < x:
                ok = False
        if ok:
            minimum = min(minimum, rikaido[0])
#         temp.append(rikaido)
# minimum = 10**20
# for i in range(len(temp)):
#     for j in range(1, m+1):
#         if temp[i][j] < x:
#             break
#         minimum = min(minimum, temp[i][0])
if minimum == 10**20:
    print((-1))
else:
    print(minimum)

import itertools
import math
import fractions
import functools

n, m, x = list(map(int, input().split()))
a_do = []
for i in range(n):
    a = list(map(int, input().split()))
    a_do.append(a)
nums = []
for i in range(n):
    nums.append(i)
temp = []
for i in range(1, n + 1):
    for v in itertools.combinations(nums, i):
        rikaido = [0] * (m + 1)
        for j in range(len(v)):
            for k in range(m + 1):
                rikaido[k] += a_do[v[j]][k]
        temp.append(rikaido)
minimum = 10**20
for i in range(len(temp)):
    ok = True
    for j in range(1, m + 1):
        if temp[i][j] < x:
            ok = False
    if ok:
        minimum = min(minimum, temp[i][0])
if minimum == 10**20:
    print((-1))
else:
    print(minimum)

-minimum = 10**20 -    for v in itertools.combinations(nums, i):  # 参考書の選び方 +    for v in itertools.combinations(nums, i): -        ok = True -        for j in range(1, m + 1): -            if rikaido[j] < x: -                ok = False -        if ok: -            minimum = min(minimum, rikaido[0]) -#         temp.append(rikaido) -# minimum = 10**20 -# for i in range(len(temp)): -#     for j in range(1, m+1): -#         if temp[i][j] < x: -#             break -#         minimum = min(minimum, temp[i][0]) +        temp.append(rikaido) +minimum = 10**20 +for i in range(len(temp)): +    ok = True +    for j in range(1, m + 1): +        if temp[i][j] < x: +            ok = False +    if ok: +        minimum = min(minimum, temp[i][0])