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

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

ans = float("inf")

for i in range(1<<n):

    cnt = [0]*m

    cost = 0

    for j in range(n):

        if i >> j & 1:

            cost += c[j][0]

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

                cnt[k-1] += c[j][k]

    for j in range(m):

        if cnt[j] < x: break

    else:

        ans = min(cost,ans)

print((ans if ans != float("inf") else -1))

            

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

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

inf = float("inf")

ans = inf

for i in range(1<<n):

    cnt = [0]*m

    cost = 0

    for j in range(n):

        if i >> j & 1:

            cost += c[j][0]

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

                cnt[k-1] += c[j][k]

    for j in range(m):

        if cnt[j] < x: break

    else:

        ans = min(cost,ans)

print((ans if ans != inf else -1))

n, m, x = list(map(int, input().split()))
c = [[int(i) for i in input().split()] for _ in range(n)]
ans = float("inf")
for i in range(1 << n):
    cnt = [0] * m
    cost = 0
    for j in range(n):
        if i >> j & 1:
            cost += c[j][0]
            for k in range(1, m + 1):
                cnt[k - 1] += c[j][k]
    for j in range(m):
        if cnt[j] < x:
            break
    else:
        ans = min(cost, ans)
print((ans if ans != float("inf") else -1))

n, m, x = list(map(int, input().split()))
c = [[int(i) for i in input().split()] for _ in range(n)]
inf = float("inf")
ans = inf
for i in range(1 << n):
    cnt = [0] * m
    cost = 0
    for j in range(n):
        if i >> j & 1:
            cost += c[j][0]
            for k in range(1, m + 1):
                cnt[k - 1] += c[j][k]
    for j in range(m):
        if cnt[j] < x:
            break
    else:
        ans = min(cost, ans)
print((ans if ans != inf else -1))

-ans = float("inf") +inf = float("inf") +ans = inf -print((ans if ans != float("inf") else -1)) +print((ans if ans != inf else -1))