#include <bits/stdc++.h>
using namespace std;
int INF = 100000000;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  string s;
  getline(cin, s);
  vector<string> planets(n);
  vector<vector<int>> a(m), b(m), c(m);
  for (int i = 0; i < m; ++i) {
    a[i].resize(n);
    b[i].resize(n);
    c[i].resize(n);
  }
  for (int i = 0; i < n; ++i) {
    getline(cin, planets[i]);
    for (int j = 0; j < m; ++j) {
      cin >> a[j][i] >> b[j][i] >> c[j][i];
    }
    getline(cin, s);
  }
  int d[110][15][15];
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int p = 0; p < n; ++p) {
        d[i][j][p] = b[i][p] - a[i][j];
      }
    }
  }
  vector<vector<vector<pair<int, int>>>> vig(n);
  for (int i = 0; i < n; ++i) {
    vig[i].resize(n);
    for (int j = 0; j < n; ++j) {
      if (j == i) {
        for (int p = 0; p < m; ++p) {
          vig[i][j].push_back(make_pair(-INF, INF));
        }
        continue;
      }
      for (int p = 0; p < m; ++p) {
        vig[i][j].push_back(make_pair(d[p][i][j], c[p][i]));
      }
      sort(vig[i][j].begin(), vig[i][j].end());
      reverse(vig[i][j].begin(), vig[i][j].end());
    }
  }
  vector<vector<int>> ansij(n);
  for (int i = 0; i < n; ++i) ansij[i].assign(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      int cnt = k;
      for (int p = 0; p < m; ++p) {
        if (vig[i][j][p].first < 0) break;
        if (cnt - vig[i][j][p].second < 0) {
          ansij[i][j] += vig[i][j][p].first * cnt;
        } else {
          ansij[i][j] += vig[i][j][p].first * vig[i][j][p].second;
        }
        cnt -= vig[i][j][p].second;
        if (cnt <= 0) break;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      if (ans < ansij[i][j]) {
        ans = ansij[i][j];
      }
    }
  cout << ans;
  return 0;
}
