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

#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define x first
#define y second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

#define ll long long
#define ld long double

const ld EPS = 10e-9;
const int INF = 1e9 + 5;
const long long INFLL = (ll)INF * (ll)INF;
const ll MOD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "[";
    for (int i = 0; i < (int)v.size(); ++i) {
        os << v[i];
        if (i != (int)v.size() - 1)
            os << ", ";
    }
    os << "]\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const unordered_set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    os << "\n";
    return os;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(...)
#endif


// __gcd(x, y)

void rec(vector<vector<int>>& mat, vector<int>& knowledge, int start, int X, ll& cost, int rows_used, ll curr_cost)
{
    if(rows_used == mat.size())
    {
        return;
    }

    for(int i = start; i < mat.size(); i++)
    {
        curr_cost += mat[i][0];
        for(int j = 0; j < sz(knowledge); j++)
            knowledge[j] += mat[i][j+1];

        bool enough = true;
        for(int j = 0; j < sz(knowledge); j++)
        {
            if(knowledge[j] < X)
            {
                enough = false;
                break;
            }
        }

        if(enough)
            cost = min(cost, curr_cost);

        rec(mat, knowledge, i+1, X, cost, rows_used+1, curr_cost);

        curr_cost -= mat[i][0];
        for(int j = 0; j < sz(knowledge); j++)
            knowledge[j] -= mat[i][j+1];
    }
}

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

    int n, m, X;
    cin >> n >> m >> X;

    vector<int> prices;
    vector<vector<int>> mat;
    for(int i = 0; i < n; i++)
    {

        vector<int> row;
        for(int j = 0; j <= m; j++)
        {
            int a;
            cin >> a;
            row.pb(a);
        }
        mat.pb(row);
    }


    vector<int> knowledge(m, 0);
    ll cost = INT_MAX;
    rec(mat, knowledge, 0, X, cost, 0, 0);

    bool enough = true;
    for(int j = 0; j < sz(knowledge); j++)
    {
        if(knowledge[j] < X)
        {
            enough = false;
            break;
        }
    }

    cout << (cost == INT_MAX ? -1 : cost) << endl;
    return 0;
}



Measured memory_bytes: 3628