def resolve():

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

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



	pay = float('inf')

	for i in range(1 << n):

		selected = []

		for j in range(n):

			if i >> j & 1:

				selected.append(j)

		rem = [0] * m

		tmp_pay = 0

		for j in selected:

			tmp_pay += books[j][0]

			for k in range(1, m+1):

				rem[k-1] += books[j][k]

		done = True

		for j in range(m):

			if rem[j] < x:

				done = False

		if done:

			pay = min(pay, tmp_pay)

	if pay == float('inf'):

		print((-1))

	else:

		print(pay)

resolve()
def resolve():

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

	c_seq = []

	a_seq = []

	ans = float('inf')

	for i in range(n):

		c, *a = list(map(int, input().split()))

		c_seq.append(c)

		a_seq.append(a)

	for i in range(1 << n):

		pay = 0

		skill = [0]*m

		for j in range(n):

			if i >> j & 1:

				pay += c_seq[j]

				for k in range(m):

					skill[k] += a_seq[j][k]

		ok = True

		for y in skill:

			if x > y:

				ok = False

		if ok:

			ans = min(ans, pay)

	print((ans if ans < float('inf') else -1))

resolve()
def resolve():
    n, m, x = list(map(int, input().split()))
    books = [list(map(int, input().split())) for _ in range(n)]
    pay = float("inf")
    for i in range(1 << n):
        selected = []
        for j in range(n):
            if i >> j & 1:
                selected.append(j)
        rem = [0] * m
        tmp_pay = 0
        for j in selected:
            tmp_pay += books[j][0]
            for k in range(1, m + 1):
                rem[k - 1] += books[j][k]
        done = True
        for j in range(m):
            if rem[j] < x:
                done = False
        if done:
            pay = min(pay, tmp_pay)
    if pay == float("inf"):
        print((-1))
    else:
        print(pay)


resolve()

def resolve():
    n, m, x = list(map(int, input().split()))
    c_seq = []
    a_seq = []
    ans = float("inf")
    for i in range(n):
        c, *a = list(map(int, input().split()))
        c_seq.append(c)
        a_seq.append(a)
    for i in range(1 << n):
        pay = 0
        skill = [0] * m
        for j in range(n):
            if i >> j & 1:
                pay += c_seq[j]
                for k in range(m):
                    skill[k] += a_seq[j][k]
        ok = True
        for y in skill:
            if x > y:
                ok = False
        if ok:
            ans = min(ans, pay)
    print((ans if ans < float("inf") else -1))


resolve()

-    books = [list(map(int, input().split())) for _ in range(n)] -    pay = float("inf") +    c_seq = [] +    a_seq = [] +    ans = float("inf") +    for i in range(n): +        c, *a = list(map(int, input().split())) +        c_seq.append(c) +        a_seq.append(a) -        selected = [] +        pay = 0 +        skill = [0] * m -                selected.append(j) -        rem = [0] * m -        tmp_pay = 0 -        for j in selected: -            tmp_pay += books[j][0] -            for k in range(1, m + 1): -                rem[k - 1] += books[j][k] -        done = True -        for j in range(m): -            if rem[j] < x: -                done = False -        if done: -            pay = min(pay, tmp_pay) -    if pay == float("inf"): -        print((-1)) -    else: -        print(pay) +                pay += c_seq[j] +                for k in range(m): +                    skill[k] += a_seq[j][k] +        ok = True +        for y in skill: +            if x > y: +                ok = False +        if ok: +            ans = min(ans, pay) +    print((ans if ans < float("inf") else -1))