import Control.Monad
import Data.Maybe

binaryAllSearch :: Int -> [[Int]]
binaryAllSearch n
 | n < 0    = [[]]
 | otherwise = [n:binaryElem | binaryElem <- binaryAllSearch (n - 1)] ++ binaryAllSearch (n - 1)

getSkillInfo :: IO [Int]
getSkillInfo = map read . words <$> getLine

getCosts ::  [[Int]] -> [Int] -> Int -> [Int] -> Maybe Int
getCosts a b x total
 | b == []   = if and (map (\n -> n >= x) (tail total)) then return (head total) else Nothing
 | otherwise = getCosts a (tail b) x (zipWith (+) (a !! (head b)) total) 

getAllCosts :: [[Int]] -> [[Int]] -> Int -> Int -> [Maybe Int] -> Int
getAllCosts a b m x ans
 | b == []   = if null tmp then -1 else minimum tmp
 | otherwise = getAllCosts a (tail b) m x ((getCosts a (head b) x (replicate (m + 1) 0)):ans)
  where tmp = map fromJust $ filter (\x -> x /= Nothing) ans

main = do
 [n,m,x] <- map read . words <$> getLine :: IO[Int]
 a <- replicateM n getSkillInfo
 print $ getAllCosts a (binaryAllSearch (n - 1)) m x []
 
