#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

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