#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(12);
  vector<int> aaa(12);
  vector<int> bbb(12);
  vector<int> ccc(12);
  vector<int> ddd(12);
  vector<int> eee(12);
  vector<int> fff(12);
  vector<int> ggg(12);
  vector<int> hhh(12);
  vector<int> iii(12);
  vector<int> jjj(12);
  vector<int> kkk(12);
  vector<int> lll(12);
  rep(i,n) {
    cin >> c.at(i);
    rep(j,m) {
      if (i == 0) cin >> aaa.at(j);
      if (i == 1) cin >> bbb.at(j);
      if (i == 2) cin >> ccc.at(j);
      if (i == 3) cin >> ddd.at(j);
      if (i == 4) cin >> eee.at(j);
      if (i == 5) cin >> fff.at(j);
      if (i == 6) cin >> ggg.at(j);
      if (i == 7) cin >> hhh.at(j);
      if (i == 8) cin >> iii.at(j);
      if (i == 9) cin >> jjj.at(j);
      if (i == 10) cin >> kkk.at(j);
      if (i == 11) cin >> lll.at(j);
    }
  }
  vector<int> mm(12);
  int kane = 0, ans = 10000000;
  rep(a,2) {
    rep(b,2) {
      rep(cc,2) {
        rep(d,2) {
          rep(e,2) {
            rep(f,2) {
              rep(g,2) {
                rep(h,2) {
                  rep(i,2) {
                    rep(j,2) {
                      rep(k,2) {
                        rep(l,2) {
                          kane = 0;
                          mm = {0,0,0,0,0,0,0,0,0,0,0,0};
                          if (a == 1) {
                            kane += c.at(0);
                            rep(p,m) mm.at(p) += aaa.at(p);
                          }
                          if (b == 1) {
                            kane += c.at(1);
                            rep(p,m) mm.at(p) += bbb.at(p);
                          }
                          if (cc == 1) {
                            kane += c.at(2);
                            rep(p,m) mm.at(p) += ccc.at(p);
                          }
                          if (d == 1) {
                            kane += c.at(3);
                            rep(p,m) mm.at(p) += ddd.at(p);
                          }
                          if (e == 1) {
                            kane += c.at(4);
                            rep(p,m) mm.at(p) += eee.at(p);
                          }
                          if (f == 1) {
                            kane += c.at(5);
                            rep(p,m) mm.at(p) += fff.at(p);
                          }
                          if (g == 1) {
                            kane += c.at(6);
                            rep(p,m) mm.at(p) += ggg.at(p);
                          }
                          if (h == 1) {
                            kane += c.at(7);
                            rep(p,m) mm.at(p) += hhh.at(p);
                          }
                          if (i == 1) {
                            kane += c.at(8);
                            rep(p,m) mm.at(p) += iii.at(p);
                          }
                          if (j == 1) {
                            kane += c.at(9);
                            rep(p,m) mm.at(p) += jjj.at(p);
                          }
                          if (k == 1) {
                            kane += c.at(10);
                            rep(p,m) mm.at(p) += kkk.at(p);
                          }
                          if (l == 1) {
                            kane += c.at(11);
                            rep(p,m) mm.at(p) += lll.at(p);
                          }
                          int flag = 1;
                          rep(p,m) {
                            if (mm.at(p) < x) flag = 0;
                          }
                          if (flag == 1) ans = min(ans,kane);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  if (ans != 10000000) cout << ans << endl;
  else cout << "-1" << endl;
}

Measured memory_bytes: 3612