import numpy as np,sys

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

N,M,X = LI()

CA = np.array([LI() for _ in range(N)])

ans = float('INF')

for i in range(2**N):

    bit = np.array([[i>>j&1 for j in range(N)]]).T

    t = np.sum(CA*bit,axis=0)

    if np.all(t[1:]>=X):

        ans = min(ans,t[0])

print((ans if ans !=float('INF') else -1))
import numpy as np,sys

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

N,M,X = LI()

CA = np.array([LI() for _ in range(N)])

ans = float('INF')

for i in range(2**N):

    bit = np.array([[i>>j&1 for j in range(N)]]).T

    temp = (CA*bit).sum(axis=0)

    if (temp[1:]>=X).all():

        ans = min(ans,temp[0])

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

import numpy as np, sys


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


N, M, X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float("INF")
for i in range(2**N):
    bit = np.array([[i >> j & 1 for j in range(N)]]).T
    t = np.sum(CA * bit, axis=0)
    if np.all(t[1:] >= X):
        ans = min(ans, t[0])
print((ans if ans != float("INF") else -1))

import numpy as np, sys


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


N, M, X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float("INF")
for i in range(2**N):
    bit = np.array([[i >> j & 1 for j in range(N)]]).T
    temp = (CA * bit).sum(axis=0)
    if (temp[1:] >= X).all():
        ans = min(ans, temp[0])
print((ans if ans != float("INF") else -1))

-    t = np.sum(CA * bit, axis=0) -    if np.all(t[1:] >= X): -        ans = min(ans, t[0]) +    temp = (CA * bit).sum(axis=0) +    if (temp[1:] >= X).all(): +        ans = min(ans, temp[0])