n = gets.chomp.to_i
a = []
n.times do
  a << gets.chomp.split.map(&:to_i)
end

dp = Array.new(n, Array.new(3, 0))

dp[0] = [0, 0, 0]

for i in 1..n-2
  for j in 0..2
    for k in 0..2
      if j != k
        dp[i+1][k] = [dp[i+1][k], dp[i][j] + a[i+1][k]].max
      end
    end
  end
end

puts dp.last.max
