n = gets.to_i
dp = Array.new(n+1){[]}
dp[0] = [0,0,0]
n.times do |i|
  h = gets.split.map(&:to_i)
  dp[i+1][0] = [dp[i][1], dp[i][2]].max + h[0]
  dp[i+1][1] = [dp[i][0], dp[i][2]].max + h[1]
  dp[i+1][2] = [dp[i][0], dp[i][1]].max + h[2]
end
p dp[n].max
