#include <bits/stdc++.h>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef pair<int, int> Pii;

int main() {
    int n,d,x;
    cin >> n >> d >> x;
    int p[d][n];
    rep(d)repp(j, n) cin >> p[i][j];

    map<int, int> dp;
    int diff = INT_MIN;
    rep(d+1){
        if(diff > 0) x += diff;

        if(i == d-1) break;
        dp.clear();
        dp[0] = 0;
        diff = INT_MIN;

        repp(j, n){
            for(auto itr=dp.begin();itr!=dp.end();++itr){
                int pp = itr->first;
                dp[pp] = max(dp[pp], dp[pp]);
                if(pp + p[i][j] > x) continue;
                dp[pp + p[i][j]] = max(dp[pp], dp[pp] + (p[i+1][j] - p[i][j]));
                diff = max({diff,dp[pp], dp[pp+p[i][j]]});
            }
        }
    }
    cout << x << endl;
    return 0;
}
