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

n.times do |i|
  a, b, c = gets.chomp.split.map(&:to_i)
  if i == 0
    dp[0] = [a, b, c]
  else
    dp[i][0] = [dp[i - 1][1], dp[i - 1][2]].max + a
    dp[i][1] = [dp[i - 1][2], dp[i - 1][0]].max + b
    dp[i][2] = [dp[i - 1][0], dp[i - 1][1]].max + c
  end
end

puts dp[-1].max