#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<double,double> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<30;




int main(){
    int n,d,x;
    cin >> n >> d >> x;
    int dp[100001];
    int p[n][n];
    for(int i=0;i<d;i++){
        for(int j=0;j<n;j++){
            cin >> p[i][j];
        }
    }
    int maxi=x;
    for(int i=0;i<d-1;i++){
        memset(dp,0,sizeof(dp));
        int tmp=0;
        for(int j=0;j<n;j++){
            for(int k=p[i][j];k<=maxi;k++){
                if(!dp[k-p[i][j]]&&k-p[i][j]!=0) continue;
                if(k-p[i][j]<0) continue;
                dp[k]=max(dp[k],dp[k-p[i][j]]+p[i+1][j]);
                tmp=max(dp[k]+maxi-k,tmp);
            }
        }
        maxi=max(maxi,tmp);
    }
    cout << maxi << endl;
    return 0;
}

