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

cost = []

a = []

for i in range(n):

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

    cost.append(ca[0])

    a.append(ca[1:])



ans = 10**7

for bit in range(2**n):

    alg = [0 for i in range(m)]

    ccount = 0

    for i in range(n):

        if bit >> i & 1:

            for j in range(m):

                alg[j] += a[i][j]

            ccount += cost[i]

    if min(alg) >= x:

        ans = min(ans,ccount)

if ans == 10**7:

    print((-1))

else:

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

c = []

for i in range(n):

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

    c.append(ci)

t = [0 for i in range(m+1)]

def dfs(l,i):

    if i == n:

        if min(l[1:]) >= x:

            return l[0]

        else:

            return 10**9

    d = l[:]

    for j in range(m+1):

        d[j] += c[i][j]

    return min(dfs(l,i+1),dfs(d,i+1))

ans = dfs(t,0)

if ans == 10**9:

    print((-1))

    exit()

print(ans)
n, m, x = list(map(int, input().split()))
cost = []
a = []
for i in range(n):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    a.append(ca[1:])
ans = 10**7
for bit in range(2**n):
    alg = [0 for i in range(m)]
    ccount = 0
    for i in range(n):
        if bit >> i & 1:
            for j in range(m):
                alg[j] += a[i][j]
            ccount += cost[i]
    if min(alg) >= x:
        ans = min(ans, ccount)
if ans == 10**7:
    print((-1))
else:
    print(ans)

n, m, x = list(map(int, input().split()))
c = []
for i in range(n):
    ci = list(map(int, input().split()))
    c.append(ci)
t = [0 for i in range(m + 1)]


def dfs(l, i):
    if i == n:
        if min(l[1:]) >= x:
            return l[0]
        else:
            return 10**9
    d = l[:]
    for j in range(m + 1):
        d[j] += c[i][j]
    return min(dfs(l, i + 1), dfs(d, i + 1))


ans = dfs(t, 0)
if ans == 10**9:
    print((-1))
    exit()
print(ans)

-cost = [] -a = [] +c = [] -    ca = list(map(int, input().split())) -    cost.append(ca[0]) -    a.append(ca[1:]) -ans = 10**7 -for bit in range(2**n): -    alg = [0 for i in range(m)] -    ccount = 0 -    for i in range(n): -        if bit >> i & 1: -            for j in range(m): -                alg[j] += a[i][j] -            ccount += cost[i] -    if min(alg) >= x: -        ans = min(ans, ccount) -if ans == 10**7: +    ci = list(map(int, input().split())) +    c.append(ci) +t = [0 for i in range(m + 1)] + + +def dfs(l, i): +    if i == n: +        if min(l[1:]) >= x: +            return l[0] +        else: +            return 10**9 +    d = l[:] +    for j in range(m + 1): +        d[j] += c[i][j] +    return min(dfs(l, i + 1), dfs(d, i + 1)) + + +ans = dfs(t, 0) +if ans == 10**9: -else: -    print(ans) +    exit() +print(ans)