#include <stdio.h>
#include <math.h>
#define MAX(x, y) (((x)>(y))?(x):(y))

int dp[100001];

int getMaxProfit(int money, int n, int today[], int next[])
{
	if(dp[money] >= 0) return dp[money];
	
	int profit, max_profit = -1;
	for(int i = 0; i < n; i++){
		if(money < today[i]) continue;
		profit = (next[i] - today[i]) + getMaxProfit(money - today[i], n, today, next);
		if(max_profit < profit) max_profit = profit;
	}
	if(max_profit == -1) max_profit = 0;
	dp[money] = max_profit;
	return max_profit;
}



int main(void)
{
  int n, d, x;
  int p[10][10];

  scanf("%d %d %d", &n, &d, &x);
  for(int i = 0; i < d; i++){
    for(int j = 0; j < n; j++){
      scanf("%d", &(p[i][j]));
    }
  }

  int money = x;
  for(int i = 0; i < d-1; i++){
  	for(int j = 0; j < 100001; j++) dp[j] = -1;
    money += getMaxProfit(money, n, p[i], p[i+1]);
  }

  printf("%d\n", money);
  return 0;
}