N = gets.to_i
dp = Array.new(N + 1){[0,0,0]}
(1 .. N).each do |n|
  a,b,c = gets.split.map(&:to_i)
  dp[n][0] = [dp[n - 1][1] + a, dp[n - 1][2] + a].max
  dp[n][1] = [dp[n - 1][2] + b, dp[n - 1][0] + b].max
  dp[n][2] = [dp[n - 1][0] + c, dp[n - 1][1] + c].max
end
puts dp[N].max
