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

c = [0] * n

for i in range(n):

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



ans = 10**10

for i in range(2 ** n):

    state = [0] * n

    for j in range(n):

        state[j] = (i >> j) & 1

    #print(state)

    num = [0] * m

    val = 0



    for j in range(n):

        if state[j] == 1:

            for k in range(m):

                num[k] += c[j][k+1]

            val += c[j][0]



    flag = True

    for j in range(m):

        if num[j] < x:

            flag = False

            break

    if flag:

        ans = min(ans, val)



if ans == 10**10:

    print((-1))

else:

    print(ans)
from itertools import product



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

c = [0] * n

a = [0] * n

for i in range(n):

    inp = [int(_) for _ in input().split()]

    c[i] = inp[0]

    a[i] = inp[1:]



INIT = 10**10

ans = INIT

pat = list(product([0, 1], repeat=n))



for p in pat:

    a_val = [0] * m

    c_yen = 0



    for i in range(n):

        if p[i] == 1:

            c_yen += c[i]

            for j in range(m):

                a_val[j] += a[i][j]



    flag = True

    for i in range(m):

        if a_val[i] < x:

            flag = False

            break

    if flag:

        ans = min(ans, c_yen)



if ans == INIT:

    print((-1))

else:

    print(ans)

n, m, x = list(map(int, input().split()))
c = [0] * n
for i in range(n):
    c[i] = [int(_) for _ in input().split()]
ans = 10**10
for i in range(2**n):
    state = [0] * n
    for j in range(n):
        state[j] = (i >> j) & 1
    # print(state)
    num = [0] * m
    val = 0
    for j in range(n):
        if state[j] == 1:
            for k in range(m):
                num[k] += c[j][k + 1]
            val += c[j][0]
    flag = True
    for j in range(m):
        if num[j] < x:
            flag = False
            break
    if flag:
        ans = min(ans, val)
if ans == 10**10:
    print((-1))
else:
    print(ans)

from itertools import product

n, m, x = list(map(int, input().split()))
c = [0] * n
a = [0] * n
for i in range(n):
    inp = [int(_) for _ in input().split()]
    c[i] = inp[0]
    a[i] = inp[1:]
INIT = 10**10
ans = INIT
pat = list(product([0, 1], repeat=n))
for p in pat:
    a_val = [0] * m
    c_yen = 0
    for i in range(n):
        if p[i] == 1:
            c_yen += c[i]
            for j in range(m):
                a_val[j] += a[i][j]
    flag = True
    for i in range(m):
        if a_val[i] < x:
            flag = False
            break
    if flag:
        ans = min(ans, c_yen)
if ans == INIT:
    print((-1))
else:
    print(ans)

+from itertools import product + +a = [0] * n -    c[i] = [int(_) for _ in input().split()] -ans = 10**10 -for i in range(2**n): -    state = [0] * n -    for j in range(n): -        state[j] = (i >> j) & 1 -    # print(state) -    num = [0] * m -    val = 0 -    for j in range(n): -        if state[j] == 1: -            for k in range(m): -                num[k] += c[j][k + 1] -            val += c[j][0] +    inp = [int(_) for _ in input().split()] +    c[i] = inp[0] +    a[i] = inp[1:] +INIT = 10**10 +ans = INIT +pat = list(product([0, 1], repeat=n)) +for p in pat: +    a_val = [0] * m +    c_yen = 0 +    for i in range(n): +        if p[i] == 1: +            c_yen += c[i] +            for j in range(m): +                a_val[j] += a[i][j] -    for j in range(m): -        if num[j] < x: +    for i in range(m): +        if a_val[i] < x: -        ans = min(ans, val) -if ans == 10**10: +        ans = min(ans, c_yen) +if ans == INIT: