@n = gets.chomp.to_i

@dp = Array.new(100_100).map{ Array.new(3, 0) }

@a = []
@n.times do
  @a << gets.chomp.split.map(&:to_i)
end
# @a[][0] => a, @a[][1] => b, @a[][2] => c

@n.times do |i|
  @dp[i+1][0] = [
    @dp[i+1][0],
    @dp[i][1] + @a[i][0],
    @dp[i][2] + @a[i][0]
  ].max
  @dp[i+1][1] = [
    @dp[i+1][1],
    @dp[i][0] + @a[i][1],
    @dp[i][2] + @a[i][1]
  ].max
  @dp[i+1][2] = [
    @dp[i+1][2],
    @dp[i][0] + @a[i][2],
    @dp[i][1] + @a[i][2]
  ].max
end

puts [@dp[@n][0], @dp[@n][1], @dp[@n][2]].max