#include<bits/stdc++.h>
using namespace std;

#define ll long long int
ll mod=1e9+7;

// vector<ll> g[200005];
// ll vis[200005];
// queue<ll> q;
// ll level[200005];

// void dfs(ll i)
// {
//     vis[i] = 1;
//     for(ll j=0;j<g[i].size();j++)
//     {
//         ll child = g[i][j];
//         if(vis[child] == 0)
//         {
//             dfs(child);
//         }
//     }
// }

// void bfs(ll i)
// {
//     vis[i] = 1;
//     while(!q.empty())
//     {
//         ll top = q.front();
//         ll len_adj = g[top].size();
//         ll j;
//         for(j=0;j<len_adj;j++)
//         {
//             ll v = g[top][j];
//             if(vis[v]==0)
//             {
//                 vis[v]=1;
//                 q.push(v);
//                 level[v] = level[top] + 1;
//             }
//         }   
//         q.pop();
//     }
// }

ll modular_exponentiation(ll base, ll power)
{
    ll ans = 1;
    base = base % mod;
    while (power > 0)
    {
        if (power & 1)
        {
            ans = (ans * base) % mod;
        }

        power /= 2;
        base = (base * base) % mod;
    }
    return ans;
}

typedef struct book
{
    ll arr[13];
    ll cost;
} Book;

vector<ll> DecToBinary(ll num,ll n)
{
    vector<ll> bits;
    while(num > 0)
    {
        bits.push_back(num%2);
        num /= 2;
    }

    while(bits.size() < n)
    {
        bits.push_back(0);
    }
    return bits;
}

int main()
{
    /* Faster input ouput */
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);

    /* To read input from a file and output to a file */
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    
    ll t = 1;
    // cin >> t;
    while(t--)
    {        
        ll n,i,j,m,x,k;
        cin >> n >> m >> x;

        Book books[n];

        for(i=0;i<n;i++)
        {
            cin >> books[i].cost;
            for(j=0;j<m;j++)
            {
                cin >> books[i].arr[j];
            }
        }

        ll num = pow(2,n);
        ll cost = INT_MAX;
        for(i=0;i<num;i++)
        {
            vector<ll> bits = DecToBinary(i,n);

            // cout << i << '\n';
            // for(j=bits.size()-1;j>=0;j--)
            // {
            //     cout << bits[j];
            // }
            // cout << '\n';

            ll algo[m];
            ll curr_cost = 0;
            for(j=0;j<m;j++)
            {
                algo[j] = 0;
            }

            for(j=0;j<bits.size();j++)
            {
                if(bits[j] == 1)
                {
                    // cout << j  << " YES\n";
                    
                    for(k=0;k<m;k++)
                    {
                        algo[k] += (books[j].arr[k]);
                    }
                    curr_cost += books[j].cost;
                }
            }

            // cout << curr_cost << '\n';

            int flag = 1;
            for(j=0;j<m;j++)
            {
                if(algo[j] < x)
                {
                    flag = 0;
                }
            }

            

            if(flag == 1)
            {
                cost = min(cost,curr_cost);
            }

            // cout << flag  << " " << cost <<  '\n';
            // cout << '\n';
        }

        if(cost == INT_MAX)
        {
            cout << -1 << '\n';
        }
        else
        {
            cout << cost << '\n';
        }
        

    }

    
    
}

Measured memory_bytes: 4104