n = gets.to_i
dp = Array.new(n) { Array.new(3) }
dp[0][0], dp[0][1], dp[0][2] = gets.split.map(&:to_i)

(n - 1).times do |i|
  a, b, c = gets.split.map(&:to_i)
  dp[i + 1][0] = [dp[i][1], dp[i][2]].max + a
  dp[i + 1][1] = [dp[i][0], dp[i][2]].max + b
  dp[i + 1][2] = [dp[i][0], dp[i][1]].max + c
end

puts dp[n - 1].max
