#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main()
{
    int n, d, x;
    cin >> n >> d >> x;
    vector<vector<ll>> p(d, vector<ll>(n));
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < n; j++) {
            cin >> p[i][j];
        }
    }
    ll money = x;
    for (int i = 0; i < d - 1; i++) {
        vector<ll> profit(n);
        for (int j = 0; j < n; j++) {
            profit[j] = p[i + 1][j] - p[i][j];
        }
        vector<vector<ll>> inner_dp(n + 1, vector<ll>(money + 1, -1));
        inner_dp[0][0] = 0;
        for (int j = 0; j < n; j++) {
            for (int m = 0; m <= money; m++) {
                if (inner_dp[j][m] > -1) {
                    inner_dp[j + 1][m] = inner_dp[j][m];
                }
            }
            for (int m = 0; m <= money; m++) {
                if (inner_dp[j + 1][m] > -1 and m + p[i][j] <= money) {
                    inner_dp[j + 1][m + p[i][j]] = max(inner_dp[j + 1][m + p[i][j]], inner_dp[j + 1][m] + profit[j]);
                }
            }
        }
        ll maxi = 0;
        for (int j = 0; j <= money; j++) {
            maxi = max(maxi, inner_dp[n][j]);
        }
        money += maxi;
    }
    cout << money << endl;

    return 0;
}