n = gets.to_i
abc = gets.split.map(&:to_i)
dp=Array.new(n+1,Array.new(3,0))
dp[1][0]=abc[0]
dp[1][1]=abc[1]
dp[1][2]=abc[2]
for i in 2..n
  abc = gets.split.map(&:to_i)
  dp[i][0]+=[abc[1],abc[2]].max
  dp[i][1]+=[abc[2],abc[0]].max
  dp[i][2]+=[abc[0],abc[1]].max
end
puts dp[n].max
