#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <iomanip>
#include<queue>
#include <iomanip>
#include<set>
using namespace std;
#define REP(i,k,n) for(ll i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007


struct range{
    ll cost;
    ll num;
};

int main()
{
    int N,M,X;
    cin>>N>>M>>X;

    int C[N];
    int A[N][M];
    REP(i,0,N){
        cin>>C[i];
        REP(j,0,M){
            cin>>A[i][j];
        }
    }
    int ans=INT32_MAX;
    bool enable=false;

    REP(i,0,(1<<N+1)){
        int vv[M];
        int cost=0;
        REP(j,0,M){
            vv[j]=0;
        }
        REP(j,0,N){
            if(i&(1<<j)){
                REP(k,0,M){
                    vv[k]+=A[j][k];
                }
                cost+=C[j];
            }
        }
        bool flag=true;
        REP(j,0,N){
            if(vv[j]<X){
                flag=false;
            }
        }
        if(flag){
            ans=min(ans,cost);
            enable=true;
        }
    }

    if(enable){
        cout<<ans<<endl;
    }else{
        cout<<-1<<endl;
    }

    return 0;
}