n = gets.to_i
strs = n.times.map { gets.chomp.split(' ').map(&:to_i) }

dp = Array.new(n + 10) { Array.new(3, 0) }
n.times do |i|
  3.times do |j|
    3.times do |k|
      next if j == k
      value = dp[i][j] + strs[i][k]
      dp[i+1][k] = value if dp[i+1][k] < value
    end
  end
end
puts dp[n].max