n,d,x = gets.split.map(&:to_i)
if n<= 1
  puts x 
else
  pa = gets.split.map(&:to_i)
  (d-1).times do
    pb = gets.split.map(&:to_i)
    dp = Array.new(10**5, 0)
    
    for i in 0...n
      for j in 0..x-pa[i]
        dp[j + pa[i]] = [dp[j + pa[i]], dp[j] + pb[i]].max
      end
    end
    
    y = x
    for i in 0..x
      y = [y, dp[i] + x-i].max
    end
    x = y
  end
  puts x
end