#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

using lint = long long;
using ldouble = long double;

const int INF = 1 << 30;

int main() {
    int N, D, X;
    cin >> N >> D >> X;
    vector<vector<int>> P(D, vector<int>(N));
    for (auto& v : P) {
        for (auto& p : v) cin >> p;
    }

    for (int d = 0; d < D - 1; ++d) {
        vector<int> dp(100010, -INF);
        dp[X] = 0;
        // dp[p] = p円残っているときの最大利益
        for (int i = 0; i < N; ++i) {
            if (P[d + 1][i] < P[d][i]) continue;
            for (int p = 100000 - P[d][i]; p >= 0; --p) {
                dp[p] = max(dp[p], dp[p + P[d][i]] + P[d + 1][i]);
            }
        }

        X = 0;
        for (int p = 0; p <= 100000; ++p) {
            X = max(X, p + dp[p]);
        }
    }

    cout << X << endl;
    return 0;
}

