import sys

input = sys.stdin.readline

import math

def bit_check(n,m,x,c,a):

    mx = 2**n

    bit = n

    acc_m = 10**9 + 1





    for i in range(1,mx):

        acc_u = [0] * m

        can = 0

        for b in range(bit):

            r = i & (1 << b)

            #print(x,type(x))

            if r != 0:

                v = int(math.log2(r))

                #print(i,(1 <<b ),v,c[v])

                for j in range(m):

                    acc_u[j] += a[v][j]

                can += c[v]

        #print(can,acc_u)

        #print(all([s >= 10 for s in acc_u]))

        if can < acc_m and all([s >= x for s in acc_u]):

            acc_m = can

    if acc_m > 10**9:

        return -1

    else:

        return acc_m

    

if __name__ == "__main__":

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

    c = []

    a = []

    for i in range(n):

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

        c.append(ca[0])

        a.append(ca[1:])



    print((bit_check(n,m,x,c,a)))

import sys

input = sys.stdin.readline

import math



def skill_up(bit,m,x,c,a):



    acc_m = 10**9 + 1



    for can,acc_u in aaa(bit,m,x,c,a):

        if can < acc_m and all([s >= x for s in acc_u]):

            acc_m = can

    if acc_m > 10**9:

        return -1

    else:

        return acc_m



def aaa(bit,m,x,c,a):

    mx = 2**bit

    for i in range(1,mx):

        acc_u = [0] * m

        can = 0

        for b in range(bit):

            r = i & (1 << b)

            #print(x,type(x))

            if r != 0:

                v = int(math.log2(r))

                #print(i,(1 <<b ),v,c[v])

                for j in range(m):

                    acc_u[j] += a[v][j]

                can += c[v]

        #print(can,acc_u)

        #print(all([s >= 10 for s in acc_u]))

        yield can,acc_u



if __name__ == "__main__":

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

    c = []

    a = []

    for i in range(n):

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

        c.append(ca[0])

        a.append(ca[1:])



    #print(bit_check(n,m,x,c,a))

    print((skill_up(n,m,x,c,a)))

import sys

input = sys.stdin.readline
import math


def bit_check(n, m, x, c, a):
    mx = 2**n
    bit = n
    acc_m = 10**9 + 1
    for i in range(1, mx):
        acc_u = [0] * m
        can = 0
        for b in range(bit):
            r = i & (1 << b)
            # print(x,type(x))
            if r != 0:
                v = int(math.log2(r))
                # print(i,(1 <<b ),v,c[v])
                for j in range(m):
                    acc_u[j] += a[v][j]
                can += c[v]
        # print(can,acc_u)
        # print(all([s >= 10 for s in acc_u]))
        if can < acc_m and all([s >= x for s in acc_u]):
            acc_m = can
    if acc_m > 10**9:
        return -1
    else:
        return acc_m


if __name__ == "__main__":
    n, m, x = list(map(int, input().split()))
    c = []
    a = []
    for i in range(n):
        ca = list(map(int, input().split()))
        c.append(ca[0])
        a.append(ca[1:])
    print((bit_check(n, m, x, c, a)))

import sys

input = sys.stdin.readline
import math


def skill_up(bit, m, x, c, a):
    acc_m = 10**9 + 1
    for can, acc_u in aaa(bit, m, x, c, a):
        if can < acc_m and all([s >= x for s in acc_u]):
            acc_m = can
    if acc_m > 10**9:
        return -1
    else:
        return acc_m


def aaa(bit, m, x, c, a):
    mx = 2**bit
    for i in range(1, mx):
        acc_u = [0] * m
        can = 0
        for b in range(bit):
            r = i & (1 << b)
            # print(x,type(x))
            if r != 0:
                v = int(math.log2(r))
                # print(i,(1 <<b ),v,c[v])
                for j in range(m):
                    acc_u[j] += a[v][j]
                can += c[v]
        # print(can,acc_u)
        # print(all([s >= 10 for s in acc_u]))
        yield can, acc_u


if __name__ == "__main__":
    n, m, x = list(map(int, input().split()))
    c = []
    a = []
    for i in range(n):
        ca = list(map(int, input().split()))
        c.append(ca[0])
        a.append(ca[1:])
    # print(bit_check(n,m,x,c,a))
    print((skill_up(n, m, x, c, a)))

-def bit_check(n, m, x, c, a): -    mx = 2**n -    bit = n +def skill_up(bit, m, x, c, a): +    for can, acc_u in aaa(bit, m, x, c, a): +        if can < acc_m and all([s >= x for s in acc_u]): +            acc_m = can +    if acc_m > 10**9: +        return -1 +    else: +        return acc_m + + +def aaa(bit, m, x, c, a): +    mx = 2**bit -        if can < acc_m and all([s >= x for s in acc_u]): -            acc_m = can -    if acc_m > 10**9: -        return -1 -    else: -        return acc_m +        yield can, acc_u -    print((bit_check(n, m, x, c, a))) +    # print(bit_check(n,m,x,c,a)) +    print((skill_up(n, m, x, c, a)))