#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int my_inf=2147483647;
const long long int my_linf=9223372036854775807;


int dp[11][100001];
int main() {
	int n, d, x; cin >> n >> d >> x;
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < 11; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			dp[i][j] = 0;
		}
	}
	vector<vector<int>>places(d, vector<int>(n));
	for (int i = 0; i < d; ++i) {
		for (int j = 0; j < n; ++j) {
			int p; cin >> p;
			places[i][j] = p;
		}
	}
	dp[0][x] = 0;
	int now = x;
	for (int day = 0; day < d-1; ++day) {
		for (int money = 0; money <=now; ++money) {
			if (dp[day][money] >= 0) {
				for (int k = 0; k < n; ++k) {
					if (money >= places[day][k]) {
						dp[day][money] = max(dp[day][money], max(0,dp[day][money-places[day][k]]) - places[day][k] + places[day + 1][k]);
					}
				}
			}
			
		}
		now = dp[day][now] + now;
		
	}
	
	cout <<now << endl;
	return 0;
}