
import Control.Monad
import Data.List
import Data.Maybe

main = do
    [n,m,x] <- map read . words <$> getLine :: IO [Int]
    cass <- replicateM n (map read . words <$> getLine) :: IO [[Int]]
    let ansList = map head $ filter (\(z:zs) -> all (>=x) zs) $ map (foldl (\acc ca -> zipWith (+) acc ca) (replicate (m + 1) 0)) $ filter (not . null) $subsequences cass
    print $ if ansList == [] then -1 else minimum $ ansList