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



A = []

for i in range(n):

    A.append(list(map(int, input().split())))



# print(A)



ans = float("inf")

for i in range(2 ** n):

    skill = [0] * (m+1)

    for j in range(n):

        if ((i >> j) & 1):

            for k in range(m+1):

                skill[k] += A[j][k]





    # print(ans, skill)



    if skill:

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

            if x > skill[i]:

                break

        else:

            ans = min(ans, skill[0])



if ans == float("inf"):

    print((-1))

else:

    print(ans)

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



A = [[] for _ in range(n)]

C = [0] * n



for i in range(n):

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

    C[i], A[i] = c_as[0], c_as[1:]



INF = 10 ** 9

ans = INF



for s in range(1<<n):

    smart = [0] * m

    cost_sum = 0

    for i in range(n):

        if (s >> i) % 2 == 0: continue

        cost_sum += C[i]

        for j in range(m):

            smart[j] += A[i][j]



    ok = True

    for i in range(m):

        if x > smart[i]:

            ok = False

    

    if ok:

        ans = min(ans, cost_sum)



if ans == INF:

    print((-1))

else:

    print(ans)

n, m, x = list(map(int, input().split()))
A = []
for i in range(n):
    A.append(list(map(int, input().split())))
# print(A)
ans = float("inf")
for i in range(2**n):
    skill = [0] * (m + 1)
    for j in range(n):
        if (i >> j) & 1:
            for k in range(m + 1):
                skill[k] += A[j][k]
    # print(ans, skill)
    if skill:
        for i in range(1, m + 1):
            if x > skill[i]:
                break
        else:
            ans = min(ans, skill[0])
if ans == float("inf"):
    print((-1))
else:
    print(ans)

n, m, x = list(map(int, input().split()))
A = [[] for _ in range(n)]
C = [0] * n
for i in range(n):
    c_as = list(map(int, input().split()))
    C[i], A[i] = c_as[0], c_as[1:]
INF = 10**9
ans = INF
for s in range(1 << n):
    smart = [0] * m
    cost_sum = 0
    for i in range(n):
        if (s >> i) % 2 == 0:
            continue
        cost_sum += C[i]
        for j in range(m):
            smart[j] += A[i][j]
    ok = True
    for i in range(m):
        if x > smart[i]:
            ok = False
    if ok:
        ans = min(ans, cost_sum)
if ans == INF:
    print((-1))
else:
    print(ans)

-A = [] +A = [[] for _ in range(n)] +C = [0] * n -    A.append(list(map(int, input().split()))) -# print(A) -ans = float("inf") -for i in range(2**n): -    skill = [0] * (m + 1) -    for j in range(n): -        if (i >> j) & 1: -            for k in range(m + 1): -                skill[k] += A[j][k] -    # print(ans, skill) -    if skill: -        for i in range(1, m + 1): -            if x > skill[i]: -                break -        else: -            ans = min(ans, skill[0]) -if ans == float("inf"): +    c_as = list(map(int, input().split())) +    C[i], A[i] = c_as[0], c_as[1:] +INF = 10**9 +ans = INF +for s in range(1 << n): +    smart = [0] * m +    cost_sum = 0 +    for i in range(n): +        if (s >> i) % 2 == 0: +            continue +        cost_sum += C[i] +        for j in range(m): +            smart[j] += A[i][j] +    ok = True +    for i in range(m): +        if x > smart[i]: +            ok = False +    if ok: +        ans = min(ans, cost_sum) +if ans == INF: