#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

ll n, d, x;
ll p[100][100];

ll dp[100][200000];

int main() {
	cin >> n >> d >> x;
	rep(i, d)rep(j, n)cin >> p[i][j];
	rep(i, d - 1) {
		rep(j, 100)rep(k, 100)dp[j][k] = 0;
		rep(j, n) {
			rep(k, x + 1) {
				if (k < p[i][j])dp[j + 1][k] = dp[j][k];
				else dp[j + 1][k] = max(dp[j][k],
					dp[j + 1][k - p[i][j]] + max(p[i + 1][j] - p[i][j], (ll)0));
			}
		}
		x += dp[n][x];
		//cout << x << endl;
	}
	cout << x << endl;
}