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

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m,x] <- getIntList
    (cs:ass) <- transpose <$> replicateM n getIntList
    let tfs = replicateM n [1,0]
    let ans = [sum (zipWith (*) tf cs)| tf <- tfs, all (>= x) (map (\as -> sum (zipWith (*) tf as)) ass)]
    print $ if null ans then -1 else minimum ans