#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL<<60;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------
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);
    iota(dp.begin(),dp.end(),0);
    for(int j=0; j<=x; j++){
      for(int k=0; k<n; k++){
        int now = j + p[i][k];
        if(now > x) continue;
        dp[now] = max(dp[now],dp[j] + p[i+1][k]);
      }
    }
    x = *max_element(dp.begin(),dp.end());
  }
  cout << x << endl;
  return 0;
}

