#include <bits/stdc++.h>
using namespace std;



int main() {
   int n, m, x;
   cin >> n >> m >> x;
   vector<int> c(n);
   vector<vector<int>> a(n,vector<int>(m));
   for (int i=0; i<n; i++) {
      cin >> c[i];
      for (int j=0; j<m; j++) {
         cin >> a[i][j];
      }
   }
   vector<int> b(n);
   vector<int> cand;
   int sum_c = 0;
   vector<int> sum_a(m,0);
   int ind = 0;
   for (b[0]=0; b[0]<2; b[0]++) {
      if (n > 1) {
         for (b[1]=0; b[1]<2; b[1]++) {
            if (n > 2) {
               for (b[2]=0; b[2]<2; b[2]++) {
                  if (n > 3) {
                     for (b[3]=0; b[3]<2; b[3]++) {
                        if (n > 4) {
                           for (b[4]=0; b[4]<2; b[4]++) {
                              if (n > 5) {
                                 for (b[5]=0; b[5]<2; b[5]++) {
                                    if (n > 6) {
                                       for (b[6]=0; b[6]<2; b[6]++) {
                                          if (n > 7) {
                                             for (b[7]=0; b[7]<2; b[7]++) {
                                                if (n > 8) {
                                                   for (b[8]=0; b[8]<2; b[8]++) {
                                                      if (n > 9) {
                                                         for (b[9]=0; b[9]<2; b[9]++) {
                                                            if (n > 10) {
                                                               for (b[10]=0; b[10]<2; b[10]++) {
                                                                  if (n > 11) {
                                                                     for (b[11]=0; b[11]<2; b[11]++) {
                                                                        sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                                                     }
                                                                  }
                                                                  else {
                                                                     sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                                                  }
                                                               }
                                                            }
                                                            else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                                            }
                                                         }
                                                      }
                                                      else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                                      }
                                                   }
                                                }
                                                else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                                }
                                             }
                                          }
                                          else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                          }
                                       }
                                    }
                                    else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                                    }
                                 }
                              }
                              else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                              }
                           }
                        }
                        else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                        }
                     }
                  }
                  else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
                  }
               }
            }
            else {
sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
            }
         }
      }
      else {
         sum_c = 0;
         for (int i=0; i<m; i++) {
            sum_a[i] = 0;
         }
         ind = 0;
         for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
               if (b[j] == 1) {
                  sum_a[i] += a[j][i];
               }
            }
            if (sum_a[i] < x) {
               ind = 1;
            }
         }
         if (ind == 0) {
            for (int i=0; i<n; i++) {
               if (b[i] == 1) {
                  sum_c += c[i];
               }
            }
            cand.push_back(sum_c);
         }
      }
   }
   if ((int) size(cand) == 0) cout << -1 << endl;
   else cout << *min_element(cand.begin(), cand.end()) << endl;
   return 0;
}

Measured memory_bytes: 3660