inf = 10**9

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

a = [0] * n

c = [0] * n

y = [0] * n

for i in range(n):

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

    c[i] = data[0]

    a[i] = data[1:]

ans = inf

for i in range(2**n):

    lis = [0]*n

    money = 0

    know = [0] * m

    for j in range(n):

        if (i >> j) & 1:

            money += c[j]

            for l in range(m):

                know[l] += a[j][l]

    for z in know:

        if z < x:

            break

    else:

        ans = min(ans, money)



if ans == inf:

    print((-1))

else:

    print(ans)
inf = 10**9

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

a = [0] * n

c = [0] * n

y = [0] * n

for i in range(n):

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

    c[i] = data[0]

    a[i] = data[1:]

ans = inf

for i in range(2**n):

    money = 0

    know = [0] * m

    for j in range(n):

        if (i >> j) & 1:

            money += c[j]

            for k in range(m):

                know[k] += a[j][k]

    for z in know:

        if z < x:

            break

    else:

        ans = min(ans, money)



if ans == inf:

    print((-1))

else:

    print(ans)
inf = 10**9
n, m, x = list(map(int, input().split()))
a = [0] * n
c = [0] * n
y = [0] * n
for i in range(n):
    data = list(map(int, input().split()))
    c[i] = data[0]
    a[i] = data[1:]
ans = inf
for i in range(2**n):
    lis = [0] * n
    money = 0
    know = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            money += c[j]
            for l in range(m):
                know[l] += a[j][l]
    for z in know:
        if z < x:
            break
    else:
        ans = min(ans, money)
if ans == inf:
    print((-1))
else:
    print(ans)

inf = 10**9
n, m, x = list(map(int, input().split()))
a = [0] * n
c = [0] * n
y = [0] * n
for i in range(n):
    data = list(map(int, input().split()))
    c[i] = data[0]
    a[i] = data[1:]
ans = inf
for i in range(2**n):
    money = 0
    know = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            money += c[j]
            for k in range(m):
                know[k] += a[j][k]
    for z in know:
        if z < x:
            break
    else:
        ans = min(ans, money)
if ans == inf:
    print((-1))
else:
    print(ans)

-    lis = [0] * n -            for l in range(m): -                know[l] += a[j][l] +            for k in range(m): +                know[k] += a[j][k]