#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

int n,d,x;
vector<vector<int>> p;

vector<int> dodp(const vector<int> &p, const vector<int> &q){
    vector<pair<int,int>> stf;
    for(int i = 0; i < n; i++){
        rep(i,p.size()){
            int bef = p[i], aft = q[i];
            while(bef < 100010){
                stf.emplace_back(bef,aft);
                bef *= 2;
                aft *= 2;
            }
        }
    }
    vector<int> dp(100010);
    for(auto & e : stf){
        int w, v; tie(w,v) = e;
        for(int j = 0; j < 100010; j++){
            if(j+w < 100010) dp[j+w] = max(dp[j+w], dp[j] + v);
        }
    }
    return dp;
}

int solve(){
    rep(i,d-1){
        vector<int> opt = dodp(p[i], p[i+1]);
        int y = x;
        rep(i,x+1){
            y = max(y, x-i + opt[i]);
            // cout << opt[i] << " ";
        }
        x = y;
        // cout << endl;
    }
    return x;
}

int main(){
    while(cin >> n >> d >> x && n){
        p.assign(d, vector<int>(n));
        rep(i,d)rep(j,n) cin >> p[i][j];
        cout << solve() << endl;
    }
}