#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define endl '\n'
#define loop(a,b,c) for(ll i=a;i<=b;i+=c)
#define intarr(arr,n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i]
#define inparr(arr,n) for(ll i=0;i<n;i++)cin>>arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define newline cout<<endl
#define ump unordered_map<ll,ll>
#define vec vector<ll>
#define mkp make_pair
#define disp(var1,var2) cout<<var1<<" "<<var2<<endl;
#define all(v)             v.begin(),v.end()
#define cout(var) cout<<var<<endl
#define mod2 998244353
#define fbo find_by_order  /// find kth smallest by passing k-1
#define ook order_of_key  //// find no of smaller items less than k
#define teensort(a,r,g,b) a[0]=r;a[1]=g;a[2]=b;sort(a,a+3);
#define ss second
#define ff first
#define displayarray(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
#define pi pair<ll,ll>
#define meramax 1e18
#define meramin -1e18
#define percentile 1000000007
ll calcsum(auto a,ll n)
{
    ll sum=0;
    for(ll i=0;i<n;i++)
        sum+=a[i];
    return sum;
}
 
bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
 
ll power(ll x,ll y) 
{ 
    ll temp; 
    if(y==0) 
        return 1; 
    temp=power(x,y/2); 
    if (y%2==0) 
        return temp*temp; 
    else
        return x*temp*temp; 
} 
 
ll no_of_factors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) 
    { 
        if (n % i == 0) 
        { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
 
ll gcd(ll a,ll b) 
{ 
    if (b==0) 
        return a; 
    return gcd(b,a%b);      
} 
 
ll lcm(ll a, ll b)  
{  
    return (a*b)/gcd(a, b);  
}  
 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
 
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}  
 
struct test
{
public:
    ll x,y,z;
};
 
bool compare(const test &aa,const test &bb)
{
    return aa.x<bb.x;
}
 
ll inv(ll a)
{
    ll p=mod2;
    ll b=p-2,ans=1;
    for(;b > 0;a = a * a % p,b >>= 1)if(b & 1)ans = ans * a % p;
    return ans;
}
 
ll a_pow_b(ll a,ll b)
{
    ll p=1000000007;
    ll ans=1;
    for(;b > 0;a = a * a % p,b >>= 1)if(b & 1)ans = ans * a % p;
    return ans;
}
 
ll ncr(ll n,ll m)
{
    ll p=mod2;
    if(m > n)return 0;
    ll up=1,down=1;
    for(int i=n-m+1;i<n+1;i++)up*=i,up%=p;
    for(int i=1;i<m+1;i++)down*=i,down%=p;
    return up*inv(down)%p;
}
 
bool isPerfectSquare(ll x) 
{   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
 
bool inc(ll arr[], ll n) 
{ 
    // Array has one or no element 
    if (n == 0 || n == 1) 
        return true; 
  
    for (ll i = 1; i < n; i++) 
  
        // Unsorted pair found 
        if (arr[i - 1] > arr[i]) 
            return false; 
  
    // No unsorted pair found 
    return true; 
} 
 
ll countDigit(ll n) 
{ 
    return floor(log10(n) + 1); 
} 
 
ll nth_fibo(ll n) 
{ 
  double phi = (1 + sqrt(5)) / 2; 
  return round(pow(phi, n) / sqrt(5)); 
} 
// Simple sieve to find smallest prime factors of numbers 
// smaller than MAX 
void sieve1(ll *prime) 
{ 
    for (ll i = 2; i * i <= 100001; ++i) 
    { 
        if (!prime[i]) 
            for (ll j = i * 2; j <= 100001; j += i) 
                prime[j] = i; 
    } 
    for (ll i = 1; i < 100002; ++i) 
        if (!prime[i]) 
            prime[i] = i; 
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////                                     ///////////////////////////////////////////////////////////////
////////////////////////////////////////              CODE                   ///////////////////////////////////////////////////////////////
////////////////////////////////////////                                     ///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//void AcDegaYe() 
ll ans=INT_MAX;
ll c[100][100];
void calc(ll n,ll m,ll x,ll *sum,ll j)
{
    if(j==n)
    {
        ll f=0;
        for(ll i=1;i<=m;i++)
        {
            //cout<<sum[i]<<" ";
            if(sum[i]<x)
            {
                f=1;
                break;
            }
        }
        //cout<<endl;
        if(f==0)
        {
            //cout(ans);
            ans=min(ans,sum[0]);
        }
        return;
    }
    sum[0]+=c[j][0];
    for(ll i=1;i<=m;i++)
    {
        sum[i]+=c[j][i];
    }
    calc(n,m,x,sum,j+1);
    sum[0]-=c[j][0];
    for(ll i=1;i<=m;i++)
    {
        sum[i]-=c[j][i];
    }
    calc(n,m,x,sum,j+1);
}
void AcDegaYe() 
{
    ll n,m,x;
    cin>>n>>m>>x;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<=m;j++)
        {
            cin>>c[i][j];
        }
    }
    // for(ll i=0;i<n;i++)
    // {
    //     for(ll j=0;j<=m;j++)
    //     {
    //         cout<<c[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    ll sum[m+1]{0};
    calc(n,m,x,sum,0);
    if(ans==INT_MAX)
    {
        cout(-1);
    }
    else
    {
        cout(ans);
    }
}
int main()
{   
    fastio
    //ll t;
    //cin>>t;
    ll t=1;
    while(t--)
    {
        AcDegaYe();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3700