import copy

s = input().split()



n = int(s[0])

m = int(s[1])

x = int(s[2])



s_list = [[0 for i in range(m+1)] for j in range(n)]



for i in range(n):

    r = input().split()

    s_list[i][0] = int(r[0])

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

        s_list[i][j] = int(r[j])





gen = [0] * (m + 1)

kakaku = -1



for i in range(2 ** n):

    k = i

    kari = copy.copy(gen)

    for j in reversed(list(range(n))):

        if k >= 2 ** j:

            k -= 2 ** j

            for l in range(m+1):

                kari[l] += s_list[j][l]



    check = 0

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

        if kari[j] < x:

            check = 1

            break

    if check == 0 and (kari[0] < kakaku or kakaku == -1):

        kakaku = kari[0]



print(kakaku)
import copy

s = input().split()



n = int(s[0])

m = int(s[1])

x = int(s[2])



s_list = [[0 for i in range(m+1)] for j in range(n)]



for i in range(n):

    r = input().split()

    s_list[i][0] = int(r[0])

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

        s_list[i][j] = int(r[j])





gen = [0] * (m + 1)

kakaku = -1



for i in range(2 ** n):

    kari = copy.copy(gen)

    for j in range(n):

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

            for l in range(m+1):

                kari[l] += s_list[j][l]



    check = 0

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

        if kari[j] < x:

            check = 1

            break

    if check == 0 and (kari[0] < kakaku or kakaku == -1):

        kakaku = kari[0]



print(kakaku)
import copy

s = input().split()
n = int(s[0])
m = int(s[1])
x = int(s[2])
s_list = [[0 for i in range(m + 1)] for j in range(n)]
for i in range(n):
    r = input().split()
    s_list[i][0] = int(r[0])
    for j in range(1, m + 1):
        s_list[i][j] = int(r[j])
gen = [0] * (m + 1)
kakaku = -1
for i in range(2**n):
    k = i
    kari = copy.copy(gen)
    for j in reversed(list(range(n))):
        if k >= 2**j:
            k -= 2**j
            for l in range(m + 1):
                kari[l] += s_list[j][l]
    check = 0
    for j in range(1, m + 1):
        if kari[j] < x:
            check = 1
            break
    if check == 0 and (kari[0] < kakaku or kakaku == -1):
        kakaku = kari[0]
print(kakaku)

import copy

s = input().split()
n = int(s[0])
m = int(s[1])
x = int(s[2])
s_list = [[0 for i in range(m + 1)] for j in range(n)]
for i in range(n):
    r = input().split()
    s_list[i][0] = int(r[0])
    for j in range(1, m + 1):
        s_list[i][j] = int(r[j])
gen = [0] * (m + 1)
kakaku = -1
for i in range(2**n):
    kari = copy.copy(gen)
    for j in range(n):
        if (i >> j) & 1:
            for l in range(m + 1):
                kari[l] += s_list[j][l]
    check = 0
    for j in range(1, m + 1):
        if kari[j] < x:
            check = 1
            break
    if check == 0 and (kari[0] < kakaku or kakaku == -1):
        kakaku = kari[0]
print(kakaku)

-    k = i -    for j in reversed(list(range(n))): -        if k >= 2**j: -            k -= 2**j +    for j in range(n): +        if (i >> j) & 1: