N = gets.to_i
dp = Array.new(N) { Array.new(3, 0) }
ABC = N.times.map{gets.split.map(&:to_i)}
dp[0] = ABC[0]
1.step(N-1) do |i|
  a = dp[i-1][1] + ABC[i][0]
  b = dp[i-1][2] + ABC[i][0]
  dp[i][0] = a > b ? a : b
  a = dp[i-1][0] + ABC[i][1]
  b = dp[i-1][2] + ABC[i][1]
  dp[i][1] = a > b ? a : b
  a = dp[i-1][0] + ABC[i][2]
  b = dp[i-1][1] + ABC[i][2]
  dp[i][2] = a > b ? a : b
end
puts dp.last.max