#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))

int main(){
    int n, m, x, c[12] = { 0 }, a[12][12] = { 0 }, y, z[12] = { 0 }, b, d = 1e9, all[12], flag = 0;
    scanf("%d%d%d",&n,&m,&x);
    rep(i,n){
    scanf("%d",&c[i]);
        rep(j,m){
            scanf("%d",&a[i][j]);
        }
    }

    rep(i, 4096) {
        y = 0;
        all[0] = i / 2048;
        Rep(j, 1, 12)all[j] = (i % (int)pow(2,12-j)) / pow(2,11-j);
        rep(j, 12)y += c[j] * all[j];
        for (b = 0; b < m; b++) {
            rep(j, 12)z[b] += all[j]*a[j][b];
            if (z[b] < x)flag++;
            z[b] = 0;
        }
        if (flag==0)d = mi(d, y);
        flag = 0;
    }  
    if (d == (int)1e9)puts("-1");
    else printf("%d", d);
    return 0;
}