n = gets.to_i
dp = 3.times.map{Array.new(n, 0)}

a, b, c = 0, 0, 0

n.times do |i|
  abc = gets.split.map(&:to_i)
  if i == 0
    3.times do |j|
      dp[i][j] = abc[j]
    end
  else
    dp[i][0] = abc[0] + ((b > c) ? b : c) 
    dp[i][1] = abc[1] + ((a > c) ? a : c) 
    dp[i][2] = abc[2] + ((a > b) ? a : b) 
  end
  a = dp[i][0]
  b = dp[i][1]
  c = dp[i][2]
end

puts dp[n - 1].max

