module Main where

main :: IO ()
main = do
  [_, _, x] <- (map read . words) <$> getLine
  contents <- map (map read . words) . lines <$> getContents
  print $ solve x contents

solve :: Int -> [[Int]] -> Int
solve target points = if null master_cost then -1 else minimum master_cost
  where
    table = to_table points
    allcase = filter (not . null). pattern $ table
    master_cost = map get_cost . filter (correct target) . map result $ allcase

result :: [(Int, [Int])] -> (Int, [Int])
result ((c, p):ps) = (c + cc, zipWith (+) p pp)
  where
    (cc, pp) = result ps

result [] = (0, repeat 0)


to_table :: [[Int]] -> [(Int, [Int])]
to_table = map (\p -> (head p, tail p))


pattern :: [a] -> [[a]]
pattern (p:ps) = concat . map (\pp -> [pp, p:pp] ) $ pattern ps
pattern [] = [[]]


correct :: Int -> (Int, [Int]) -> Bool
correct target (_, ps) = all (>= target) ps

get_cost :: (Int, [Int]) -> Int
get_cost (c, _) = c
