#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,p,q,c;
    ans=LLONG_MAX;
    string s1,s2;
    vector<int> v;
    cin>>n>>m>>c;
    int a[12];
    int h[n];
    int b[n][m];
    rep(i,0,n){
        cin>>h[i];
        rep(j,0,m){
            cin>>b[i][j];
        }
    }
    rep(i,0,2){//1
        rep(j,0,2){//2
            rep(w,0,2){//3
                rep(e,0,2){//4
                    rep(r,0,2){//5
                        rep(t,0,2){//6
                            rep(y,0,2){//7
                                rep(u,0,2){//8
                                    rep(o,0,2){//9
                                        rep(s,0,2){//10
                                            rep(d,0,2){//11
                                                rep(f,0,2){
                                                    int g[m];
                                                    q=0;
                                                    rep(k,0,m)g[k]=0;
                                                    a[0]=i;
                                                    a[1]=j;
                                                    a[2]=w;
                                                    a[3]=e;
                                                    a[4]=r;
                                                    a[5]=t;
                                                    a[6]=y;
                                                    a[7]=u;
                                                    a[8]=o;
                                                    a[9]=s;
                                                    a[10]=d;
                                                    a[11]=f;
                                                    rep(k,0,n){
                                                        if(a[k]){
                                                            rep(l,0,m)
                                                            g[l]+=b[k][l];
                                                            q+=h[k];
                                                        }
                                                    }
                                                    int flag=1;
                                                    rep(k,0,m){
                                                        if(g[k]<c){
                                                        flag=0;
                                                        
                                                        }
                                                    }
                                                    if(flag){
                                                        
                                                        ans=min(q,ans);
                                                    }
                                                    
                                                }
                                                
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if(ans!=LLONG_MAX)
    cout<<ans<<endl;
    else
    cout<<"-1"<<endl;
}


Measured memory_bytes: 3632