import qualified Data.ByteString.Char8 as BS
import qualified Data.List as L
import qualified Data.Set as S
import qualified Control.Monad as M
import Data.Maybe (fromJust)
import Data.Ord
import qualified Data.Vector.Unboxed as V

comb :: Int -> [a] -> [[a]]
comb 0 xs = [[]]
comb _ [] = []
comb n (x:xs) = [x:y | y <- comb (n-1) xs] ++ comb n xs

powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = [x:ps | ps <- powerset xs] ++ powerset xs

main = do
 [n,m,x] <- map (fst.fromJust.BS.readInt)<$>BS.words<$> BS.getLine
 arrays <- map ((map (fst.fromJust.BS.readInt)).BS.words)<$>M.replicateM n BS.getLine
 let allpat = init$powerset arrays
 let calc= map (foldl1 (zipWith (+))) allpat
 let filterpat = map head$filter (\(_:xs)-> and $ map ( >=x) xs ) calc
 print $ if null filterpat
  then -1
  else minimum filterpat
