n = gets.to_i
abc = n.times.map { gets.chomp.split(" ").map(&:to_i) }
dp = Array.new(n) { Array.new(3) { 0 } }
3.times do |i|
  dp[0][i] += abc[0][i]
end
1.upto(n - 1) do |i|
  3.times do |j|
    max = 0
    2.times do |k|
      cost = dp[i - 1][j - k - 1] + abc[i][j]
      max = cost if max < cost
    end
    dp[i][j] = max
  end
end
puts dp[-1].max