import itertools

import math

import fractions

import functools



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



c = []

a_do = []

for i in range(n):

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

    c.append(a[0])

    a_do.append(a[1:])



# minimum = 10**20

# for pat in range(0, (1<<n)): #参考書の選び方の全パターン

#     cost = 0

#     rikaido = [0] * m

#     for i in range(n):

#         if((pat >> i) & 1): #i番目の参考書を読む

#             cost += c[i]

#             for k in range(m):

#                 rikaido[k] += a_do[i][k]

#     ok = True

#     for k in range(m):

#         if(rikaido[k] < x):

#             ok = False

#     if(ok):

#         minimum = min(minimum, cost)



# if(minimum == 10**20):

#     print(-1)

# else:

#     print(minimum)



minimum = 10**20



nums = []

for i in range(n):

    nums.append(i)



temp = []

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

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

        cost = 0

        rikaido = [0] * (m)

        for j in range(len(v)):

            cost += c[v[j]]

            for k in range(m):

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



        ok = True

        for k in range(m):

            if rikaido[k] < x:

                ok = False



        if(ok):

            minimum = min(minimum, cost)





#         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)

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()))
c = []
a_do = []
for i in range(n):
    a = list(map(int, input().split()))
    c.append(a[0])
    a_do.append(a[1:])
# minimum = 10**20
# for pat in range(0, (1<<n)): #参考書の選び方の全パターン
#     cost = 0
#     rikaido = [0] * m
#     for i in range(n):
#         if((pat >> i) & 1): #i番目の参考書を読む
#             cost += c[i]
#             for k in range(m):
#                 rikaido[k] += a_do[i][k]
#     ok = True
#     for k in range(m):
#         if(rikaido[k] < x):
#             ok = False
#     if(ok):
#         minimum = min(minimum, cost)
# if(minimum == 10**20):
#     print(-1)
# else:
#     print(minimum)
minimum = 10**20
nums = []
for i in range(n):
    nums.append(i)
temp = []
for i in range(1, n + 1):
    for v in itertools.combinations(nums, i):
        cost = 0
        rikaido = [0] * (m)
        for j in range(len(v)):
            cost += c[v[j]]
            for k in range(m):
                rikaido[k] += a_do[v[j]][k]
        ok = True
        for k in range(m):
            if rikaido[k] < x:
                ok = False
        if ok:
            minimum = min(minimum, cost)
#         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)
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)

-c = [] -    c.append(a[0]) -    a_do.append(a[1:]) -# minimum = 10**20 -# for pat in range(0, (1<<n)): #参考書の選び方の全パターン -#     cost = 0 -#     rikaido = [0] * m -#     for i in range(n): -#         if((pat >> i) & 1): #i番目の参考書を読む -#             cost += c[i] -#             for k in range(m): -#                 rikaido[k] += a_do[i][k] -#     ok = True -#     for k in range(m): -#         if(rikaido[k] < x): -#             ok = False -#     if(ok): -#         minimum = min(minimum, cost) -# if(minimum == 10**20): -#     print(-1) -# else: -#     print(minimum) -minimum = 10**20 +    a_do.append(a) +minimum = 10**20 -    for v in itertools.combinations(nums, i): -        cost = 0 -        rikaido = [0] * (m) +    for v in itertools.combinations(nums, i):  # 参考書の選び方 +        rikaido = [0] * (m + 1) -            cost += c[v[j]] -            for k in range(m): +            for k in range(m + 1): -        for k in range(m): -            if rikaido[k] < x: +        for j in range(1, m + 1): +            if rikaido[j] < x: -            minimum = min(minimum, cost) +            minimum = min(minimum, rikaido[0])