n = gets.to_i
abc = n.times.map { gets.split.map(&:to_i) }

dp = Array.new(n) { Array.new(3) { 0 }}

dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]

1.upto(n - 1) do |i|
  dp[i][0] = [dp[i - 1][1], dp[i - 1][2]].max + abc[i][0]
  dp[i][1] = [dp[i - 1][0], dp[i - 1][2]].max + abc[i][1]
  dp[i][2] = [dp[i - 1][1], dp[i - 1][0]].max + abc[i][2]
end

puts [dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]].max
