#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 998244353

using namespace std;

vector<vector<int>> A;

void combinationUtil(vector<int> arr, vector<int> data,
    int start, int end,
    int index, int r);

// The main function that prints  
// all combinations of size r  
// in arr[] of size n. This function 
// mainly uses combinationUtil()  
void printCombination(vector<int> arr, int n, int r)
{
    // A temporary array to store 
    // all combination one by one  
    vector<int> data(r);

    // Print all combination using 
    // temprary array 'data[]'  
    combinationUtil(arr, data, 0, n - 1, 0, r);
}

/* arr[] ---> Input Array
data[] ---> Temporary array to
store current combination
start & end ---> Staring and
Ending indexes in arr[]
index ---> Current index in data[]
r ---> Size of a combination to be printed */
void combinationUtil(vector<int> arr, vector<int> data,
    int start, int end,
    int index, int r)
{
    // Current combination is ready 
    // to be printed, print it  
    if (index == r)
    {
        A.push_back(vector<int>());
        for (int j = 0; j < r; j++)
            A.back().push_back(data[j]);
        return;
    }

    // replace index with all possible  
    // elements. The condition "end-i+1 >= r-index" 
    // makes sure that including one element  
    // at index will make a combination with  
    // remaining elements at remaining positions  
    for (int i = start; i <= end &&
        end - i + 1 >= r - index; i++)
    {
        data[index] = arr[i];
        combinationUtil(arr, data, i + 1,
            end, index + 1, r);
    }
}


void solve()
{
    int n, m, x;
    cin >> n >> m >> x;

    vector<vector<int>> a(n, vector<int>(m + 1));

    for (int i = 0; i < n; i++)
    {
        cin >> a[i][0];
        for (int j = 1; j < m + 1; j++)
        {
            cin >> a[i][j];
        }
    }

    vector<int> arr(n);
    for (int i = 0; i < n; i++)
    {
        arr[i] = i + 1;
    }

    for (int i = 1; i <= n; i++)
    {
        printCombination(arr, n, i);
    }
    ll ans = -1;
    for (int i = 0; i < A.size(); i++)
    {
        bool is_fine = true;
        ll count;
        for (int j = 1; j <= m; j++)
        {
            count = 0;
            for (int k = 0; k < A[i].size(); k++)
            {
                count += a[A[i][k] - 1][j];
            }
            if (count < x)
            {
                is_fine = false;
                break;
            }
        }
        if (is_fine)
        {
            ll cost = 0;
            for (int k = 0; k < A[i].size(); k++)
            {
                cost += a[A[i][k] - 1][0];
            }
            if (ans == -1)
            {
                ans = cost;
            }
            else {
                ans = min(ans, cost);
            }
        }

    }
    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T = 1;
    // cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3888