N = gets.to_i
ABC = N.times.map { gets.split.map(&:to_i) }

dp = Array.new(N + 1) { Array.new(3, 0) }

(N-1).downto(0) do |i|
  3.times.each do |j|
    max_pt = 0
    3.times.each do |k|
      max_pt = dp[i+1][k] if j != k && max_pt < dp[i+1][k]
    end
    dp[i][j] = ABC[i][j] + max_pt
  end
end

puts dp[0].max
