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

l = [input().split() for x in range(n)]

c = [0]*n

a=[[0 for x in range(m)] for y in range(n)]

for i in range(n):

    c[i] = l[i][0]

    for j in range(m):

        a[i][j] = l[i][j+1]



ans=float('inf')

for i in range(2 ** n):

    cost = 0

    d=[0]*m

    for j in range(n):

        if i >> j & 1:

            cost += int(c[j])

            for k in range(m):

                d[k] += int(a[j][k])

    ok = True

    for x in range(m):

        if d[x] < y: ok = False

    if ok: ans = min(ans, cost)

if ans == float('inf'): print((-1))

else:print(ans)

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

c = [0] * n

a = [[0 for _ in range(m)] for i in range(n)]



for i in range(n):

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

    c[i]=l[0]

    for j in range(m):

        a[i][j] = l[j+1]



inf=float('inf')

ans=inf

for i in range(2 ** n):

    cost = 0

    d=[0]*m

    for j in range(n):

        if i >> j & 1:

            cost += c[j]

            for k in range(m):

                d[k] += a[j][k]



    ok = True

    for y in range(m):

        if d[y] < x:

            ok = False

    if ok:

        ans = min(ans, cost)

if ans == inf:

    print((-1))

else:

    print(ans)

n, m, y = list(map(int, input().split()))
l = [input().split() for x in range(n)]
c = [0] * n
a = [[0 for x in range(m)] for y in range(n)]
for i in range(n):
    c[i] = l[i][0]
    for j in range(m):
        a[i][j] = l[i][j + 1]
ans = float("inf")
for i in range(2**n):
    cost = 0
    d = [0] * m
    for j in range(n):
        if i >> j & 1:
            cost += int(c[j])
            for k in range(m):
                d[k] += int(a[j][k])
    ok = True
    for x in range(m):
        if d[x] < y:
            ok = False
    if ok:
        ans = min(ans, cost)
if ans == float("inf"):
    print((-1))
else:
    print(ans)

n, m, x = list(map(int, input().split()))
c = [0] * n
a = [[0 for _ in range(m)] for i in range(n)]
for i in range(n):
    l = [int(_) for _ in input().split()]
    c[i] = l[0]
    for j in range(m):
        a[i][j] = l[j + 1]
inf = float("inf")
ans = inf
for i in range(2**n):
    cost = 0
    d = [0] * m
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for k in range(m):
                d[k] += a[j][k]
    ok = True
    for y in range(m):
        if d[y] < x:
            ok = False
    if ok:
        ans = min(ans, cost)
if ans == inf:
    print((-1))
else:
    print(ans)

-n, m, y = list(map(int, input().split())) -l = [input().split() for x in range(n)] +n, m, x = list(map(int, input().split())) -a = [[0 for x in range(m)] for y in range(n)] +a = [[0 for _ in range(m)] for i in range(n)] -    c[i] = l[i][0] +    l = [int(_) for _ in input().split()] +    c[i] = l[0] -        a[i][j] = l[i][j + 1] -ans = float("inf") +        a[i][j] = l[j + 1] +inf = float("inf") +ans = inf -            cost += int(c[j]) +            cost += c[j] -                d[k] += int(a[j][k]) +                d[k] += a[j][k] -    for x in range(m): -        if d[x] < y: +    for y in range(m): +        if d[y] < x: -if ans == float("inf"): +if ans == inf: