#pragma GCC optimize(3)
#include<iostream>
using namespace std;
typedef unsigned long long int UL;
typedef long long int LL;
typedef unsigned short US;
typedef double DB;
LL t,n,m,price[102][102]={0},f[102]={0};
int main()
{
ios::sync_with_stdio(false);
cin>>t>>n>>m;
for (LL t1=1;t1<=t;t1++)
{
for (LL n1=1;n1<=n;n1++)
{
cin>>price[t1][n1];
}
}
for (LL t1=1;t1<t;t1++)
{
for (LL i=0;i<102;i++)
{
f[i]=0;
}
for (LL i=1;i<=n;i++)
{
for (LL v=price[t1][i];v<=m;v++)
{
f[v]=max(f[v],f[v-price[t1][i]]+price[t1+1][i]-price[t1][i]);
}
}
m+=f[m];
}
cout<<m<<endl;
return 0;
}