import numpy as np



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

costs =[]

maa = 1000000000000000000000000000

ans = maa



for i in range(n):

    a = [int(i) for i in input().split()]

    costs.append(a)

    

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

    cost = 0

    c = 0

    sums = [0] * m

    use_index=[]

    for j in range(n):

        if i%2==1:

            use_index.append(j)

        i >>= 1

    

    for v in use_index:

        c += costs[v][0]        

        for j in range(m):

            sums[j] += costs[v][j+1]

            

    judge=True

    for j in range(m):

        if sums[j]<x:

            judge=False

            break

    

    if judge:

        ans = min(ans, c)



if ans ==maa:

    print((-1))

else:

    print(ans)

            

            



    

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

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



'''

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

costs =[]



for i in range(n):

    a = [int(i) for i in input().split()]

    costs.append(a)

'''





INF = 1000000000000000000000000000

ans = INF



for i in range(1<<n):  #n bits all searches

    # 1<<n == 2**n

    c = 0

    sums = [0]*m

    for j in range(n):

        if i>>j & 1: #i>>j %2 == 1  is also fine.

            #apply this candidate. 

            c += costs[j][0]

            for k in range(m):

                sums[k] += costs[j][k+1]    

    '''

    cost = 0

    c = 0

    sums = [0] * m

    use_index=[]

    for j in range(n):

        if i%2==1:

            use_index.append(j)

        i >>= 1

    

    for v in use_index:

        c += costs[v][0]        

        for j in range(m):

            sums[j] += costs[v][j+1]

    '''

    

    if min(sums) >= x:

        ans = min(ans, c)

'''            

    judge=True

    for j in range(m):

        if sums[j]<x:

            judge=False

            break

    

    if judge:

        ans = min(ans, c)

'''

if ans==INF:

    print((-1))

else:

    print(ans)

 
import numpy as np

n, m, x = [int(i) for i in input().split()]
costs = []
maa = 1000000000000000000000000000
ans = maa
for i in range(n):
    a = [int(i) for i in input().split()]
    costs.append(a)
for i in range(1, 2**n + 1):
    cost = 0
    c = 0
    sums = [0] * m
    use_index = []
    for j in range(n):
        if i % 2 == 1:
            use_index.append(j)
        i >>= 1
    for v in use_index:
        c += costs[v][0]
        for j in range(m):
            sums[j] += costs[v][j + 1]
    judge = True
    for j in range(m):
        if sums[j] < x:
            judge = False
            break
    if judge:
        ans = min(ans, c)
if ans == maa:
    print((-1))
else:
    print(ans)

n, m, x = list(map(int, input().split()))
costs = [list(map(int, input().split())) for _ in range(n)]
"""
n,m,x = [int(i) for i in input().split()]
costs =[]
for i in range(n):
    a = [int(i) for i in input().split()]
    costs.append(a)
"""
INF = 1000000000000000000000000000
ans = INF
for i in range(1 << n):  # n bits all searches
    # 1<<n == 2**n
    c = 0
    sums = [0] * m
    for j in range(n):
        if i >> j & 1:  # i>>j %2 == 1  is also fine.
            # apply this candidate.
            c += costs[j][0]
            for k in range(m):
                sums[k] += costs[j][k + 1]
    """
    cost = 0
    c = 0
    sums = [0] * m
    use_index=[]
    for j in range(n):
        if i%2==1:
            use_index.append(j)
        i >>= 1
    for v in use_index:
        c += costs[v][0]        
        for j in range(m):
            sums[j] += costs[v][j+1]
    """
    if min(sums) >= x:
        ans = min(ans, c)
"""            
    judge=True
    for j in range(m):
        if sums[j]<x:
            judge=False
            break
    if judge:
        ans = min(ans, c)
"""
if ans == INF:
    print((-1))
else:
    print(ans)

-import numpy as np - -n, m, x = [int(i) for i in input().split()] -costs = [] -maa = 1000000000000000000000000000 -ans = maa +n, m, x = list(map(int, input().split())) +costs = [list(map(int, input().split())) for _ in range(n)] +""" +n,m,x = [int(i) for i in input().split()] +costs =[] -for i in range(1, 2**n + 1): +""" +INF = 1000000000000000000000000000 +ans = INF +for i in range(1 << n):  # n bits all searches +    # 1<<n == 2**n +    c = 0 +    sums = [0] * m +    for j in range(n): +        if i >> j & 1:  # i>>j %2 == 1  is also fine. +            # apply this candidate. +            c += costs[j][0] +            for k in range(m): +                sums[k] += costs[j][k + 1] +    """ -    use_index = [] +    use_index=[] -        if i % 2 == 1: +        if i%2==1: -        c += costs[v][0] +        c += costs[v][0] -            sums[j] += costs[v][j + 1] -    judge = True +            sums[j] += costs[v][j+1] +    """ +    if min(sums) >= x: +        ans = min(ans, c) +""" +    judge=True -        if sums[j] < x: -            judge = False +        if sums[j]<x: +            judge=False -if ans == maa: +""" +if ans == INF: