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

a=[list(map(int, input().split())) for i in range(n)]

bb=[0]*m

c=[]

cc=0

for i in range(n):

    cc+=a[i][0]

for i in range(m):

    for j in range(n):

        bb[i]+=a[j][i+1]

if any(bb[k]< x for k in range(m)):

  print((-1))

"""

d=[[] for i in range(m)]

money=0

i=0

def func(i,):

    if i==m:

        sum

        return money

    if func(i+1,money):

        return true

"""

def dec2bin(target):

    amari=[]

    while target !=0:

        amari.append(target % 2)

        target = target //2

    if len(amari)!=n:

        while len(amari)!=n:

            amari.append(0)

    amari.reverse()

    return amari

p=[]

for j in range(2**n):

    p.append(dec2bin(j))

for i in range(2**n):

    money=0

    b=[0]*m

    for j in range(n):

        if p[i][j]==1:

            money+=a[j][0]

            for aaa in range(m):

                b[aaa]+=a[j][aaa+1]

    if all(b[l]>=x for l in range(m)):

        c.append(money)



        

if len(c)>0:

  print((min(c)))



        

            

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

b=[list(map(int,input().split())) for _ in range(n)]

ans = 100000000

for i in range(1<<n):

    money = 0

    s=[0]*m

    for j in range(n):

        if(i>>j)&1:

            money +=b[j][0]

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

                s[k-1]+=b[j][k]

    if min(s)>=x:

        ans=min(ans,money)

if ans != 100000000:

    print(ans)

else:

    print((-1))

n, m, x = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
bb = [0] * m
c = []
cc = 0
for i in range(n):
    cc += a[i][0]
for i in range(m):
    for j in range(n):
        bb[i] += a[j][i + 1]
if any(bb[k] < x for k in range(m)):
    print((-1))
"""
d=[[] for i in range(m)]
money=0
i=0
def func(i,):
    if i==m:
        sum
        return money
    if func(i+1,money):
        return true
"""


def dec2bin(target):
    amari = []
    while target != 0:
        amari.append(target % 2)
        target = target // 2
    if len(amari) != n:
        while len(amari) != n:
            amari.append(0)
    amari.reverse()
    return amari


p = []
for j in range(2**n):
    p.append(dec2bin(j))
for i in range(2**n):
    money = 0
    b = [0] * m
    for j in range(n):
        if p[i][j] == 1:
            money += a[j][0]
            for aaa in range(m):
                b[aaa] += a[j][aaa + 1]
    if all(b[l] >= x for l in range(m)):
        c.append(money)
if len(c) > 0:
    print((min(c)))

n, m, x = list(map(int, input().split()))
b = [list(map(int, input().split())) for _ in range(n)]
ans = 100000000
for i in range(1 << n):
    money = 0
    s = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            money += b[j][0]
            for k in range(1, m + 1):
                s[k - 1] += b[j][k]
    if min(s) >= x:
        ans = min(ans, money)
if ans != 100000000:
    print(ans)
else:
    print((-1))

-a = [list(map(int, input().split())) for i in range(n)] -bb = [0] * m -c = [] -cc = 0 -for i in range(n): -    cc += a[i][0] -for i in range(m): +b = [list(map(int, input().split())) for _ in range(n)] +ans = 100000000 +for i in range(1 << n): +    money = 0 +    s = [0] * m -        bb[i] += a[j][i + 1] -if any(bb[k] < x for k in range(m)): +        if (i >> j) & 1: +            money += b[j][0] +            for k in range(1, m + 1): +                s[k - 1] += b[j][k] +    if min(s) >= x: +        ans = min(ans, money) +if ans != 100000000: +    print(ans) +else: -""" -d=[[] for i in range(m)] -money=0 -i=0 -def func(i,): -    if i==m: -        sum -        return money -    if func(i+1,money): -        return true -""" - - -def dec2bin(target): -    amari = [] -    while target != 0: -        amari.append(target % 2) -        target = target // 2 -    if len(amari) != n: -        while len(amari) != n: -            amari.append(0) -    amari.reverse() -    return amari - - -p = [] -for j in range(2**n): -    p.append(dec2bin(j)) -for i in range(2**n): -    money = 0 -    b = [0] * m -    for j in range(n): -        if p[i][j] == 1: -            money += a[j][0] -            for aaa in range(m): -                b[aaa] += a[j][aaa + 1] -    if all(b[l] >= x for l in range(m)): -        c.append(money) -if len(c) > 0: -    print((min(c)))