N = gets.to_i
days = N.times.map { gets.split.map(&:to_i) }

dp = Array.new(N + 1) { Array.new(3, 0) }

(1..N).each do |i|
  3.times do |j|
    3.times do |k|
      next if j == k

      val = dp[i - 1][j] + days[i - 1][k]
      dp[i][k] = val if dp[i][k] < val
    end
  end
end

puts dp[N].max
