n = gets.to_i

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

1.upto(n - 1) do |i|
  a, b, c = gets.strip.split(" ").map(&:to_i)

  dp[i][0] = a + [dp[i - 1][1], dp[i - 1][2]].max
  dp[i][1] = b + [dp[i - 1][0], dp[i - 1][2]].max
  dp[i][2] = c + [dp[i - 1][0], dp[i - 1][1]].max
end

puts dp.last.max
