N, M, X = list(map(int, input().split()))

costs = [0] * N

A = [[0] * M for _ in range(N)]

for i in range(N):

    c, *a = list(map(int, input().split()))

    costs[i] = c

    A[i] = a





INF = 1 << 31

ans = INF

for i in range(1 << N):

    curr_cost = 0

    understanding = [0] * M

    for j in range(N):

        if i >> j & 1:

            curr_cost += costs[j]

            for k in range(M):

                understanding[k] += A[j][k]

    if min(understanding) >= X:

        ans = min(ans, curr_cost)

if ans == INF:

    print((-1))

else:

    print(ans)

def dfs(i, cost, skills):

    if i == N:

        if min(skills) < X:

            return INF

        else:

            return cost

    new_skills = [a + s for a, s in zip(contents[i], skills)]

    return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills))





INF = float('inf')

N, M, X = list(map(int, input().split()))

prices = []

contents = []

for _ in range(N):

    C, *A = list(map(int, input().split()))

    prices.append(C)

    contents.append(A)

ans = dfs(0, 0, [0] * M)

if ans == INF:

    print((-1))

else:

    print(ans)

N, M, X = list(map(int, input().split()))
costs = [0] * N
A = [[0] * M for _ in range(N)]
for i in range(N):
    c, *a = list(map(int, input().split()))
    costs[i] = c
    A[i] = a
INF = 1 << 31
ans = INF
for i in range(1 << N):
    curr_cost = 0
    understanding = [0] * M
    for j in range(N):
        if i >> j & 1:
            curr_cost += costs[j]
            for k in range(M):
                understanding[k] += A[j][k]
    if min(understanding) >= X:
        ans = min(ans, curr_cost)
if ans == INF:
    print((-1))
else:
    print(ans)

def dfs(i, cost, skills):
    if i == N:
        if min(skills) < X:
            return INF
        else:
            return cost
    new_skills = [a + s for a, s in zip(contents[i], skills)]
    return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills))


INF = float("inf")
N, M, X = list(map(int, input().split()))
prices = []
contents = []
for _ in range(N):
    C, *A = list(map(int, input().split()))
    prices.append(C)
    contents.append(A)
ans = dfs(0, 0, [0] * M)
if ans == INF:
    print((-1))
else:
    print(ans)

+def dfs(i, cost, skills): +    if i == N: +        if min(skills) < X: +            return INF +        else: +            return cost +    new_skills = [a + s for a, s in zip(contents[i], skills)] +    return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills)) + + +INF = float("inf") -costs = [0] * N -A = [[0] * M for _ in range(N)] -for i in range(N): -    c, *a = list(map(int, input().split())) -    costs[i] = c -    A[i] = a -INF = 1 << 31 -ans = INF -for i in range(1 << N): -    curr_cost = 0 -    understanding = [0] * M -    for j in range(N): -        if i >> j & 1: -            curr_cost += costs[j] -            for k in range(M): -                understanding[k] += A[j][k] -    if min(understanding) >= X: -        ans = min(ans, curr_cost) +prices = [] +contents = [] +for _ in range(N): +    C, *A = list(map(int, input().split())) +    prices.append(C) +    contents.append(A) +ans = dfs(0, 0, [0] * M)