import std;

alias Book = Tuple!(int, "cost", int[], "ss");

int calc(int x, Book[] books) {
    auto n = books.length;
    auto m = books[0].ss.length;

    int ans = int.max;
    foreach (es; subsets(n.iota)) {
        int cost = 0;
        auto ss = new int[m];
        foreach (e; es) {
            cost += books[e].cost;
            foreach (k, s; books[e].ss) ss[k] += s;
        }
        if (ss.all!(e => e >= x)) {
            ans = min(ans, cost);
        }
    }
    return ans == int.max ? -1 : ans;
}

void main() {
    int n, m, x; scan(n, m, x);
    Book[] books;
    foreach (_; 0..n) {
        auto t = readints;
        books ~= Book(t[0], t[1..$]);
    }
    writeln(calc(x, books));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;

Subsets!R subsets(R)(R range)
if (isInputRange!R)
{
    return Subsets!R(range);
}

struct Subsets(R) {
    alias E = ElementType!R;
    private E[] _source;

    private E[] _current;
    private int _state;

    this(R source) {
        _source = source.array;
        assert(!_source.empty);
        _state = 0;
        next();
    }

    private void next() {
        _current = null;
        if (_state < (1 << _source.length)) {
            for (int i = 0; i < _source.length; i++) {
                if (_state & (1 << i)) _current ~= _source[i];
            }
            _state++;
        }
    }

    @property E[] front() { return _current; }
    @property bool empty() { return _current == null && _state >= (1 << _source.length); }
    void popFront() { next(); }
}
