n = gets.chomp.to_i
dp = Array.new(n + 1) do Array.new(3) end # day, act
dp[1] = gets.split.map(&:to_i)
(2..n).each do |i|
  a, b, c = gets.split.map(&:to_i)
  dp[i][0] =  [dp[i - 1][1], dp[i - 1][2]].max + a
  dp[i][1] =  [dp[i - 1][0], dp[i - 1][2]].max + b
  dp[i][2] =  [dp[i - 1][1], dp[i - 1][0]].max + c
end
puts dp[n].max