#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <locale>
#include <map>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using i32 = int32_t;
using i64 = uint64_t;
using u32 = uint32_t;
using u64 = uint64_t;
template <typename T>
T input_value() {
  T result;
  std::cin >> result;
  return result;
}

template <typename T1, typename T2>
void input_multival_to_array(const T1& n, T2& array) {
  for (T1 i = T1(0); i < n; ++i) {
    array.emplace_back(input_value<typename T2::value_type>());
  }
}

template <typename T>
std::set<T> factorize(const T& n) {
  const T sqrtn = T(sqrt(double(n)));
  std::set<T> result = {T(1), T{n}};
  for (T i = T(2); i <= sqrtn; ++i) {
    if (n % i == T(0)) {
      result.insert(i);
      result.insert(n / i);
    }
  }
}

std::optional<u32> search_price(
  const std::vector<std::pair<u32, std::vector<u32>>>& book_info_table,
  u32 target_idx, u32 acc_price, const std::vector<u32>& current_skill,
  u32 criterion) {
  using namespace std;
  if (all_of(current_skill.begin(), current_skill.end(), [&criterion](u32 s) {
        return s >= criterion;
      })) {
    return make_optional(acc_price);
  }
  if (target_idx >= book_info_table.size()) return nullopt;
  const auto total_price_if_not_buy = search_price(
    book_info_table, target_idx + u32(1), acc_price, current_skill, criterion);
  const auto target_price = book_info_table[target_idx].first;
  const auto& target_book_ability = book_info_table[target_idx].second;

  vector<u32> skill_if_buy(current_skill);
  for (u32 i = u32(0); i < skill_if_buy.size(); ++i) {
    skill_if_buy[i] += target_book_ability[i];
  }
  const auto total_price_if_buy = search_price(
    book_info_table, target_idx + u32(1), acc_price + target_price,
    skill_if_buy, criterion);
  if (total_price_if_not_buy) {
    if (total_price_if_buy) {
      return make_optional(
        min(total_price_if_buy.value(), total_price_if_not_buy.value()));
    } else {
      return total_price_if_not_buy;
    }
  } else if (total_price_if_buy) {
    return total_price_if_buy;
  } else {
    return nullopt;
  }
}

int main() {
  using namespace std;
  locale::global(locale(""));
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  const auto n_books = input_value<u32>();
  const auto n_algos = input_value<u32>();
  const auto skill_criterion = input_value<u32>();
  vector<pair<u32, vector<u32>>> book_info_table;
  vector<u32> total_skills(n_algos, u32(0));
  for (u32 i = u32(0); i < n_books; ++i) {
    const auto price = input_value<u32>();
    vector<u32> skills;
    skills.reserve(n_algos);
    input_multival_to_array(n_algos, skills);
    for (u32 j = u32(0); j < n_algos; ++j) {
      total_skills[j] += skills[j];
    }
    book_info_table.push_back(make_pair(price, skills));
  }
  if (any_of(
        total_skills.begin(), total_skills.end(),
        [&skill_criterion](u32 s) { return s < skill_criterion; })) {
    cout << "-1\n";
    return 0;
  }
  const auto lowest_cost = search_price(
    book_info_table, 0, 0, vector(n_algos, u32(0)), skill_criterion);
  if (lowest_cost) {
    cout << lowest_cost.value() << '\n';
  } else {
    cout << "-1\n";
  }
  return 0;
}


Measured memory_bytes: 4180