n = gets.to_i
h = []
n.times do
  h << gets.split.map(&:to_i)
end
dp = Array.new(n+1) { Array.new(3, 0) }
dp[0] = [0, 0, 0]
n.times do |idx|
  3.times do |abc_idx|
    dp[idx+1][(abc_idx+1)%3] = dp[idx][abc_idx] + h[idx][abc_idx] if dp[idx+1][(abc_idx+1)%3] < dp[idx][abc_idx] + h[idx][abc_idx]
    dp[idx+1][(abc_idx+2)%3] = dp[idx][abc_idx] + h[idx][abc_idx] if dp[idx+1][(abc_idx+2)%3] < dp[idx][abc_idx] + h[idx][abc_idx]
  end
end

puts dp[n].max