#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, d, x;
  cin >> n >> d >> x;
  vector<vector<int>> p(d, vector<int>(n));
  for (int i = 0; i < d; i++){
    for (int j = 0; j < n; j++){
      cin >> p[i][j];
    }
  }
  for (int i = 0; i < d - 1; i++){
    vector<int> dp(x + 1, 0); 
    for (int j = 0; j <= x; j++){
      dp[x] = x;
    }
    for (int j = 0; j < n; j++){
      for (int k = p[i][j]; k <= x; k++){
        dp[k] = max(dp[k], dp[k - p[i][j]] + p[i + 1][j]);
      }
    }
    int tmp = 0;
    for (int j = 0; j <= x; j++){
      tmp = max(tmp, x - j + dp[j]);
    }
    x = tmp;
  }
  cout << x << endl;
}
