#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple

MAX = 13 * pow(10, 5)


def solve(
    prices: List[int], values: List[List[int]], target: int, rows: int, cols: int
) -> Optional[int]:
    min_price = MAX
    for i in range(rows):
        for picked in itertools.combinations(range(rows), i + 1):
            for j in range(cols):
                if sum(values[k][j] for k in picked) < target:
                    break
            # for else
            else:
                min_price = min(min_price, sum(prices[k] for k in picked))
    return min_price if min_price < MAX else None
    # dp[i] = (p, l) min price p to get to level l (max target)
    dp = [[(0, 0)] * cols for _ in rows]
    for i in range(rows):
        pi = prices[i]
        vi = values[i]
        dp = []
        for j in range(cols):
            if l < target:
                dp.append((pi + p, l + vi[j]))
    return target


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    N, M, X = map(int, input().split())
    values = []
    prices = []
    for _ in range(N):
        p, *v = map(int, input().split())
        assert len(v) == M
        prices.append(p)
        values.append(v)
    result = solve(prices, values, X, N, M)
    print(result if result else -1)


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result))


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            # uncachable -- for instance, passing a list as an argument.
            # Better to not cache than to blow up entirely.
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)


Measured memory_bytes: 99316