def solve():

    N,M,X = list(map(int,input().split()))

    C = []

    A = []

    for i in range(N):

        val = list(map(int,input().split()))

        C.append(val[0])

        A.append(val[1:])

    

    ans = float('inf')

    for i in range(1 << N):

        money = 0

        points = [0] * M

        for j in range(N):

            if (i >> j) & 1:

                money += C[j]

                for k in range(M):

                    points[k] += A[j][k]

        

        for j in range(M):

            if points[j] < X:

                break

        else:

            ans = min(ans,money)



    print((ans if ans != float('inf') else -1))





                

if __name__ == '__main__':

    solve()
def solve():

    N,M,X = list(map(int,input().split()))

    C = []

    A = []

    for _ in range(N):

        CA = list(map(int,input().split()))

        C.append(CA[0])

        A.append(CA[1:])

    

    ans = float('inf')

    for i in range(1<<N):

        cost_sum = 0

        power = [0] * M

        for j in range(N):

            if (i >> j) & 1:

                cost_sum += C[j]

                for k in range(M):

                    power[k] += A[j][k]

        

        isOk = True

        for j in range(M):

            if power[j] < X:

                isOk = False

                break

        

        if isOk:

            ans = min(ans, cost_sum)

    

    print((ans if ans != float('inf') else -1))

        

if __name__ == '__main__':

    solve()

def solve():
    N, M, X = list(map(int, input().split()))
    C = []
    A = []
    for i in range(N):
        val = list(map(int, input().split()))
        C.append(val[0])
        A.append(val[1:])
    ans = float("inf")
    for i in range(1 << N):
        money = 0
        points = [0] * M
        for j in range(N):
            if (i >> j) & 1:
                money += C[j]
                for k in range(M):
                    points[k] += A[j][k]
        for j in range(M):
            if points[j] < X:
                break
        else:
            ans = min(ans, money)
    print((ans if ans != float("inf") else -1))


if __name__ == "__main__":
    solve()

def solve():
    N, M, X = list(map(int, input().split()))
    C = []
    A = []
    for _ in range(N):
        CA = list(map(int, input().split()))
        C.append(CA[0])
        A.append(CA[1:])
    ans = float("inf")
    for i in range(1 << N):
        cost_sum = 0
        power = [0] * M
        for j in range(N):
            if (i >> j) & 1:
                cost_sum += C[j]
                for k in range(M):
                    power[k] += A[j][k]
        isOk = True
        for j in range(M):
            if power[j] < X:
                isOk = False
                break
        if isOk:
            ans = min(ans, cost_sum)
    print((ans if ans != float("inf") else -1))


if __name__ == "__main__":
    solve()

-    for i in range(N): -        val = list(map(int, input().split())) -        C.append(val[0]) -        A.append(val[1:]) +    for _ in range(N): +        CA = list(map(int, input().split())) +        C.append(CA[0]) +        A.append(CA[1:]) -        money = 0 -        points = [0] * M +        cost_sum = 0 +        power = [0] * M -                money += C[j] +                cost_sum += C[j] -                    points[k] += A[j][k] +                    power[k] += A[j][k] +        isOk = True -            if points[j] < X: +            if power[j] < X: +                isOk = False -        else: -            ans = min(ans, money) +        if isOk: +            ans = min(ans, cost_sum)