import sys, bisect, math, itertools, string, queue, copy

# import numpy as np

# import scipy

from collections import Counter,defaultdict,deque

from itertools import permutations, combinations

from heapq import heappop, heappush

from fractions import gcd

# input = sys.stdin.readline

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(eval(input()))

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

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

def inpls(): return list(input().split())

def inplm(n): return list(int(eval(input())) for _ in range(n))

def inplL(n): return [list(eval(input())) for _ in range(n)]

def inplT(n): return [tuple(eval(input())) for _ in range(n)]

def inpll(n): return [list(map(int, input().split())) for _ in range(n)]

def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])



def main():

    n,m,x = inpm()

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

    ans = float('inf')

    for num in range(1,n+1):

        for e in combinations(list(range(n)),num):

            cost = 0

            under = [0 for _ in range(m)]

            for f in e:

                cost += c[f][0]

                for i in range(m):

                    under[i] += c[f][i+1]

            if min(under) >= x:

                ans = min(ans,cost)

    if ans == float('inf'):

        print((-1))

    else:

        print(ans)



    

if __name__ == "__main__":

    main()
import sys

from itertools import combinations

input = sys.stdin.readline



def main():

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

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

    ans = float('inf')

    for num in range(1,n+1):

        for e in combinations(list(range(n)),num):

            cost = 0

            under = [0 for _ in range(m)]

            for f in e:

                cost += c[f][0]

                for i in range(m):

                    under[i] += c[f][i+1]

            if min(under) >= x:

                ans = min(ans,cost)

    if ans == float('inf'):

        print((-1))

    else:

        print(ans)

 

    

if __name__ == "__main__":

    main()

import sys, bisect, math, itertools, string, queue, copy

# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd

# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(eval(input()))


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


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


def inpls():
    return list(input().split())


def inplm(n):
    return list(int(eval(input())) for _ in range(n))


def inplL(n):
    return [list(eval(input())) for _ in range(n)]


def inplT(n):
    return [tuple(eval(input())) for _ in range(n)]


def inpll(n):
    return [list(map(int, input().split())) for _ in range(n)]


def inplls(n):
    return sorted([list(map(int, input().split())) for _ in range(n)])


def main():
    n, m, x = inpm()
    c = [list(map(int, input().split())) for _ in range(n)]
    ans = float("inf")
    for num in range(1, n + 1):
        for e in combinations(list(range(n)), num):
            cost = 0
            under = [0 for _ in range(m)]
            for f in e:
                cost += c[f][0]
                for i in range(m):
                    under[i] += c[f][i + 1]
            if min(under) >= x:
                ans = min(ans, cost)
    if ans == float("inf"):
        print((-1))
    else:
        print(ans)


if __name__ == "__main__":
    main()

import sys
from itertools import combinations

input = sys.stdin.readline


def main():
    n, m, x = list(map(int, input().split()))
    c = [list(map(int, input().split())) for _ in range(n)]
    ans = float("inf")
    for num in range(1, n + 1):
        for e in combinations(list(range(n)), num):
            cost = 0
            under = [0 for _ in range(m)]
            for f in e:
                cost += c[f][0]
                for i in range(m):
                    under[i] += c[f][i + 1]
            if min(under) >= x:
                ans = min(ans, cost)
    if ans == float("inf"):
        print((-1))
    else:
        print(ans)


if __name__ == "__main__":
    main()

-import sys, bisect, math, itertools, string, queue, copy +import sys +from itertools import combinations -# import numpy as np -# import scipy -from collections import Counter, defaultdict, deque -from itertools import permutations, combinations -from heapq import heappop, heappush -from fractions import gcd - -# input = sys.stdin.readline -sys.setrecursionlimit(10**8) -mod = 10**9 + 7 - - -def inp(): -    return int(eval(input())) - - -def inpm(): -    return list(map(int, input().split())) - - -def inpl(): -    return list(map(int, input().split())) - - -def inpls(): -    return list(input().split()) - - -def inplm(n): -    return list(int(eval(input())) for _ in range(n)) - - -def inplL(n): -    return [list(eval(input())) for _ in range(n)] - - -def inplT(n): -    return [tuple(eval(input())) for _ in range(n)] - - -def inpll(n): -    return [list(map(int, input().split())) for _ in range(n)] - - -def inplls(n): -    return sorted([list(map(int, input().split())) for _ in range(n)]) +input = sys.stdin.readline -    n, m, x = inpm() +    n, m, x = list(map(int, input().split()))