import std;

// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}
T[] lreads(T=long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}
void arywrite(T=long)(T[] ary){ary.map!(text).join(' ').writeln;}
void scan(TList...)(ref TList Args){auto line = readln.split;
foreach (i,T;TList){T val=line[i].to!(T);Args[i]=val;}}
void dprint(TList...)(TList Args){debug{auto s=new string[](TList.length);
static foreach(i,a;Args) s[i]=text(a);s.map!(text).join(' ').writeln;}}
alias sread=()=>readln.chomp();enum MOD =10^^9+7;
alias PQueue(T,alias less="a<b") = BinaryHeap!(Array!T,less);
// dfmt on

void main()
{
    long N, M, X;
    scan(N, M, X);
    auto CA = new long[][](N);
    foreach (i; 0 .. N)
        CA[i] = aryread();
    long ans = long.max;
    o: foreach (state; 1 .. (1 << N))
    {
        long cost;
        auto x = new long[](M);
        foreach (i; 0 .. N)
            if (state & (1 << i))
            {
                cost += CA[i][0];
                x[] += CA[i][1 .. $];
            }
        // writefln("%020b %s", state, cost);
        foreach (i; 0 .. M)
            if (x[i] < X)
                continue o;
        ans = ans.min(cost);
    }
    writeln(ans == long.max ? -1 : ans);
}
