def ip():return list(map(int,input().split()))



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

c=[]

a=[]

for i in range(n):

    temp=ip()

    c.append(temp[0])

    a.append(temp[1:])



ans=12*10**5+1

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

    f=bin(i)[2:]

    sum=[0]*m

    while len(f)<n:f='0'+f

    s=0

    for j in range(n):

        if f[j]=='1':

            s+=c[j]

            for h in range(m):

                sum[h]+=a[j][h]

    F=True

    for h in range(m):

        if sum[h]<x:F=False

    if F==True:ans=min(ans,s)

print(ans) if ans!=12*10**5+1 else print(-1)













def ip():return list(map(int,input().split()))



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

c=[]

a=[]

for i in range(n):

    temp=ip()

    c.append(temp[0])

    a.append(temp[1:])



ans=12*10**5+1

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

    f=bin(i)[2:]

    sum=[0]*m

    while len(f)<n:f='0'+f

    s=0

    for j in range(n):

        if f[j]=='1':

            s+=c[j]

            for h in range(m):

                sum[h]+=a[j][h]

    if min(sum)>=x:ans=min(ans,s)

print(ans) if ans!=12*10**5+1 else print(-1)













def ip():
    return list(map(int, input().split()))


n, m, x = map(int, input().split())
c = []
a = []
for i in range(n):
    temp = ip()
    c.append(temp[0])
    a.append(temp[1:])
ans = 12 * 10**5 + 1
for i in range(1, 2**n):
    f = bin(i)[2:]
    sum = [0] * m
    while len(f) < n:
        f = "0" + f
    s = 0
    for j in range(n):
        if f[j] == "1":
            s += c[j]
            for h in range(m):
                sum[h] += a[j][h]
    F = True
    for h in range(m):
        if sum[h] < x:
            F = False
    if F == True:
        ans = min(ans, s)
print(ans) if ans != 12 * 10**5 + 1 else print(-1)

def ip():
    return list(map(int, input().split()))


n, m, x = map(int, input().split())
c = []
a = []
for i in range(n):
    temp = ip()
    c.append(temp[0])
    a.append(temp[1:])
ans = 12 * 10**5 + 1
for i in range(1, 2**n):
    f = bin(i)[2:]
    sum = [0] * m
    while len(f) < n:
        f = "0" + f
    s = 0
    for j in range(n):
        if f[j] == "1":
            s += c[j]
            for h in range(m):
                sum[h] += a[j][h]
    if min(sum) >= x:
        ans = min(ans, s)
print(ans) if ans != 12 * 10**5 + 1 else print(-1)

-    F = True -    for h in range(m): -        if sum[h] < x: -            F = False -    if F == True: +    if min(sum) >= x: