N = gets.chomp.to_i
abc = []
N.times do
  abc << gets.chomp.split(" ").map(&:to_i)
end

dp = { 0 => {}, 1 => {}, 2 => {} }
0.upto(2) {|j| dp[j][-1] = 0 }

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

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