#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,d,x;
	cin>>n>>d>>x;
	vector<vector<ll>> p(d,vector<ll>(n));
	REP(i,d) REP(j,n) cin>>p[i][j];
	REP(i,d-1) {
		vector<vector<ll>> dp(n,vector<ll>(x+1,-INF*INF));
		dp[0][0]=0;
		REP(j,n) REP(k,x+1) {
			if(j!=0) dp[j][k]=max(dp[j][k],dp[j-1][k]);
			if(p[i][j]<=k) dp[j][k]=max(dp[j][k],dp[j][k-p[i][j]]+(p[i+1][j]-p[i][j]));
		}
		ll tmp=-INF*INF;
		REP(j,x+1) if(dp[n-1][j]>=0) tmp=max(tmp,x+dp[n-1][j]);
		x=tmp;
	}
	cout<<x<<endl;
}


