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

a_list = list()



l = list()

ans = []



for i in range(0, n):

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





for i in range(1, 2**n):

    num = format(i, '0' + str(n) + 'b')

    l.append(num)



# print(l)



list_len = len(l)



s = 0



tmp = [0]*(m+1)



for i in range(0, list_len):

    w_len = m

    num = l[i]

    for j in range(0, n):

        if int(num[j]) == 1:

            for z in range(0, m+1):

                tmp[z] += a_list[j][z]

    # print(tmp)

    if len(list([number for number in tmp[1:] if number >= x])) == m:

        ans.append(tmp[0])

    tmp = [0]*(m+1)



# print(ans)



if ans == []:

    print((-1))

else:

    print((min(ans)))

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



a_list = list()

c_list = list()



INF = 1001001001



for i in range(0, n):

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

    c = tmp.pop(0)

    c_list.append(c)

    a_list.append(tmp)



ans = INF



for s in range(0, 1 << n):

    cost = 0

    d = [0]*m

    for i in range(0, n):

        if s >> i & 1:

            cost += c_list[i]

            for j in range(0, m):

                d[j] += a_list[i][j]

    ok = True

    for j in range(0, m):

        if d[j] < x:

            ok = False

    if ok:

        ans = min(ans, cost)



if ans == INF:

    print((-1))

else:

    print(ans)

n, m, x = list(map(int, input().split()))
a_list = list()
l = list()
ans = []
for i in range(0, n):
    a_list.append(list(map(int, input().split())))
for i in range(1, 2**n):
    num = format(i, "0" + str(n) + "b")
    l.append(num)
# print(l)
list_len = len(l)
s = 0
tmp = [0] * (m + 1)
for i in range(0, list_len):
    w_len = m
    num = l[i]
    for j in range(0, n):
        if int(num[j]) == 1:
            for z in range(0, m + 1):
                tmp[z] += a_list[j][z]
    # print(tmp)
    if len(list([number for number in tmp[1:] if number >= x])) == m:
        ans.append(tmp[0])
    tmp = [0] * (m + 1)
# print(ans)
if ans == []:
    print((-1))
else:
    print((min(ans)))

n, m, x = list(map(int, input().split()))
a_list = list()
c_list = list()
INF = 1001001001
for i in range(0, n):
    tmp = list(map(int, input().split()))
    c = tmp.pop(0)
    c_list.append(c)
    a_list.append(tmp)
ans = INF
for s in range(0, 1 << n):
    cost = 0
    d = [0] * m
    for i in range(0, n):
        if s >> i & 1:
            cost += c_list[i]
            for j in range(0, m):
                d[j] += a_list[i][j]
    ok = True
    for j in range(0, m):
        if d[j] < x:
            ok = False
    if ok:
        ans = min(ans, cost)
if ans == INF:
    print((-1))
else:
    print(ans)

-l = list() -ans = [] +c_list = list() +INF = 1001001001 -    a_list.append(list(map(int, input().split()))) -for i in range(1, 2**n): -    num = format(i, "0" + str(n) + "b") -    l.append(num) -# print(l) -list_len = len(l) -s = 0 -tmp = [0] * (m + 1) -for i in range(0, list_len): -    w_len = m -    num = l[i] -    for j in range(0, n): -        if int(num[j]) == 1: -            for z in range(0, m + 1): -                tmp[z] += a_list[j][z] -    # print(tmp) -    if len(list([number for number in tmp[1:] if number >= x])) == m: -        ans.append(tmp[0]) -    tmp = [0] * (m + 1) -# print(ans) -if ans == []: +    tmp = list(map(int, input().split())) +    c = tmp.pop(0) +    c_list.append(c) +    a_list.append(tmp) +ans = INF +for s in range(0, 1 << n): +    cost = 0 +    d = [0] * m +    for i in range(0, n): +        if s >> i & 1: +            cost += c_list[i] +            for j in range(0, m): +                d[j] += a_list[i][j] +    ok = True +    for j in range(0, m): +        if d[j] < x: +            ok = False +    if ok: +        ans = min(ans, cost) +if ans == INF: -    print((min(ans))) +    print(ans)