n,m,x=[int(j) for j in input().split()]

l=[]

import numpy as np

for i in range(n):

    tmp=[int(j) for j in input().split()]

    l.append((tmp[0],np.array(tmp[1:])))

ans=10**18

for i in range(1<<n):

    tl=np.array([0]*m)

    tc=0

    for j in range(n):

        if i>>j&1:

            c,ll=l[j]

            tc+=c

            tl+=ll

    if len(tl[tl>=x])==m:

        ans=min(ans,tc)



if ans!=10**18:

    print(ans)

else:

    print((-1))
n,m,x=[int(j) for j in input().split()]

l=[]

import numpy as np

for i in range(n):

    tmp=[int(j) for j in input().split()]

    l.append((tmp[0],np.array(tmp[1:])))

ans=10**18

import itertools

for i in itertools.product(list(range(2)),repeat=n):

    tl=np.array([0]*m)

    tc=0

    for idx,j in enumerate(i):

        if j==1:

            c,ll=l[idx]

            tc+=c

            tl+=ll

    if len(tl[tl>=x])==m:

        ans=min(ans,tc)



if ans!=10**18:

    print(ans)

else:

    print((-1))
n, m, x = [int(j) for j in input().split()]
l = []
import numpy as np

for i in range(n):
    tmp = [int(j) for j in input().split()]
    l.append((tmp[0], np.array(tmp[1:])))
ans = 10**18
for i in range(1 << n):
    tl = np.array([0] * m)
    tc = 0
    for j in range(n):
        if i >> j & 1:
            c, ll = l[j]
            tc += c
            tl += ll
    if len(tl[tl >= x]) == m:
        ans = min(ans, tc)
if ans != 10**18:
    print(ans)
else:
    print((-1))

n, m, x = [int(j) for j in input().split()]
l = []
import numpy as np

for i in range(n):
    tmp = [int(j) for j in input().split()]
    l.append((tmp[0], np.array(tmp[1:])))
ans = 10**18
import itertools

for i in itertools.product(list(range(2)), repeat=n):
    tl = np.array([0] * m)
    tc = 0
    for idx, j in enumerate(i):
        if j == 1:
            c, ll = l[idx]
            tc += c
            tl += ll
    if len(tl[tl >= x]) == m:
        ans = min(ans, tc)
if ans != 10**18:
    print(ans)
else:
    print((-1))

-for i in range(1 << n): +import itertools + +for i in itertools.product(list(range(2)), repeat=n): -    for j in range(n): -        if i >> j & 1: -            c, ll = l[j] +    for idx, j in enumerate(i): +        if j == 1: +            c, ll = l[idx]