import std;

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

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

    int ans = int.max;
    for (int i = 0; i < (1 << p); i++) {
        int cost = 0;
        auto ss = new int[n];
        for (int j = 0; j < p; j++) {
            if (i & (1 << j)) {
                cost += books[j].cost;
                foreach (k, s; books[j].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;
