#include <iostream>
#include <vector>

using namespace std;

int main(void){
    int n, d, x;
    cin >> n >> d >> x;
    vector<vector<int> > v(d, vector<int>(n));
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < n; j++) {
            cin >> v[i][j];
        }
    }
    vector<int> cash(d,0);
    cash[0] = x;
    for (int l = 0; l < d; l++) {
        for (int r = l+1; r < d; r++) {
            int ma = cash[l];
            vector<int> dp(ma+1, ma);
            for (int i = l; i < r; i++) {
                for (int j = 0; j < n; j++) {
                    int a = v[i][j];
                    int b = v[r][j];
                    for (int k = ma; k-a >= 0; k--) dp[k-a] = max(dp[k-a], dp[k]+b-a);
                }
            }
            cash[r] = max(cash[r], dp[0]);
        }
    }
    cout << cash[d-1] << endl;
}