import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

addlist :: Num a => [a] -> [a] -> [a]
addlist xs [] = xs
addlist [] ys = ys
addlist (x:xs) (y:ys) = (x + y) : addlist xs ys

calc :: Num a => [a] -> [[a]] -> [a]
calc _ [] = []
calc [] _ = []
calc (c:cs) (xs:xss) = addlist (map (*c) xs) (calc cs xss) 

main = do
  [n, m, x] <- getIntList
  cs <- map readIntList <$> replicateM (fromIntegral n) BS.getLine
  let ps = replicateM (fromIntegral n) [0, 1]
  let results = filter (\t -> all (>=x) (tail t)) [calc p cs| p <- ps]
  if results == [] then
  	putStrLn $ "-1"
  else
    putStrLn $ show $ minimum (map head results)