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

int n, d;
int ans[15] = {0};
int p[15][15] = {0};
int dp[15][15][100005] = {0};

void solve();

int main() {
  int i, j;
  cin >> n >> d >> ans[0];
  for(i = 0; i < d; ++i)
    for(j = 0; j < n; ++j) cin >> p[i][j];
  for(i = 0; i < d; ++i) p[i][n] = 1;
  ++n;
  for(i = 0; i < d; ++i) ans[i] = ans[0];
  solve();
  cout << ans[d - 1] << endl;
  return 0;
}

void solve() {
  int i, j, k;
  for(i = 0; i < d - 1; ++i) {
    for(j = 0; j < n; ++j) {
      for(k = 0; k <= ans[i]; ++k) {
        if(j != 0) dp[i][j][k] = dp[i][j - 1][k];
        if(p[i][j] <= k)
          dp[i][j][k] =
              max(dp[i][j][k],
                  dp[i][j][k - p[i][j]] + p[i + 1][j]);
        ans[i + 1] = max(ans[i + 1], dp[i][j][k]);
      }
    }
  }
}
