#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define pb push_back

int solve(int x,vector<int> wait,vector<int>value){
    static int dp[11][200000];
    rep(i,11)rep(j,200000)dp[i][j] = 0;
    int n = wait.size();
    for(int i=1;i<=n;i++){
        rep(j,x+1){
            dp[i][j] = dp[i-1][j];
            if(j-wait[i-1]>=0){
                dp[i][j] = max( dp[i][j] , dp[i][j-wait[i-1]]+value[i-1] );
            }
        }
    }
    return dp[n][x];
}

int main(){
    int n,d,x;
    cin>>n>>d>>x;
    int shares[11][11];
    rep(i,d){
        rep(j,n){
            cin>>shares[i][j];
        }
    }
    rep(i,d-1){
        vector<int> diff,cost;
        rep(j,n){
            diff.pb(shares[i+1][j]-shares[i][j]);
            cost.pb(shares[i][j]);
        }
        x+=solve(x,cost,diff);
    }
    cout<<x<<endl;
}