def main():

    from sys import stdin

    import itertools

    n,m,x = list(map(int,stdin.readline().rstrip().split()))

    mat = []

    for _ in range(n):

        temp = list(map(int,stdin.readline().rstrip().split()))

        mat.append(temp)

    

    sum = []

    for i in range(n+1):

        for l in itertools.combinations(mat,i):

            temp = [0]*(m+1)

            for k in range(m+1):

                for j in l:

                    temp[k]+=j[k]

            sum.append(temp)

    

    sum.sort(key=lambda x: x[0])

    for l in sum:

        ans = -1

        flag = True

        for j in l[1:]:

            if j < x:

                flag = False

                break

        

        if flag:

            ans=l[0]

            break

    

    print(ans)

main()
import math

def solve(C,A,x,k,s,U):

    if k == 0:

        if min(U) >= x:

            return s

        else:

            return math.inf

    

    else:

        s_use = s+C[k-1]

        U_use = [u+a for u,a in zip(U,A[k-1])]



        return min(solve(C,A,x,k-1,s,U),solve(C,A,x,k-1,s_use,U_use))



        



def main():

    from sys import stdin

    n,m,x = list(map(int,stdin.readline().rstrip().split()))

    C = []

    A = []

    for _ in range(n):

        temp = list(map(int,stdin.readline().rstrip().split()))

        C.append(temp[0])

        A.append(temp[1:])

    

    U = [0]*m

    ans = solve(C,A,x,n,0,U)

    print((ans if ans != math.inf else -1))

    

main()
def main():
    from sys import stdin
    import itertools

    n, m, x = list(map(int, stdin.readline().rstrip().split()))
    mat = []
    for _ in range(n):
        temp = list(map(int, stdin.readline().rstrip().split()))
        mat.append(temp)
    sum = []
    for i in range(n + 1):
        for l in itertools.combinations(mat, i):
            temp = [0] * (m + 1)
            for k in range(m + 1):
                for j in l:
                    temp[k] += j[k]
            sum.append(temp)
    sum.sort(key=lambda x: x[0])
    for l in sum:
        ans = -1
        flag = True
        for j in l[1:]:
            if j < x:
                flag = False
                break
        if flag:
            ans = l[0]
            break
    print(ans)


main()

import math


def solve(C, A, x, k, s, U):
    if k == 0:
        if min(U) >= x:
            return s
        else:
            return math.inf
    else:
        s_use = s + C[k - 1]
        U_use = [u + a for u, a in zip(U, A[k - 1])]
        return min(solve(C, A, x, k - 1, s, U), solve(C, A, x, k - 1, s_use, U_use))


def main():
    from sys import stdin

    n, m, x = list(map(int, stdin.readline().rstrip().split()))
    C = []
    A = []
    for _ in range(n):
        temp = list(map(int, stdin.readline().rstrip().split()))
        C.append(temp[0])
        A.append(temp[1:])
    U = [0] * m
    ans = solve(C, A, x, n, 0, U)
    print((ans if ans != math.inf else -1))


main()

+import math + + +def solve(C, A, x, k, s, U): +    if k == 0: +        if min(U) >= x: +            return s +        else: +            return math.inf +    else: +        s_use = s + C[k - 1] +        U_use = [u + a for u, a in zip(U, A[k - 1])] +        return min(solve(C, A, x, k - 1, s, U), solve(C, A, x, k - 1, s_use, U_use)) + + -    import itertools -    mat = [] +    C = [] +    A = [] -        mat.append(temp) -    sum = [] -    for i in range(n + 1): -        for l in itertools.combinations(mat, i): -            temp = [0] * (m + 1) -            for k in range(m + 1): -                for j in l: -                    temp[k] += j[k] -            sum.append(temp) -    sum.sort(key=lambda x: x[0]) -    for l in sum: -        ans = -1 -        flag = True -        for j in l[1:]: -            if j < x: -                flag = False -                break -        if flag: -            ans = l[0] -            break -    print(ans) +        C.append(temp[0]) +        A.append(temp[1:]) +    U = [0] * m +    ans = solve(C, A, x, n, 0, U) +    print((ans if ans != math.inf else -1))