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)

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

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)

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