N = gets.to_i

X = (1..N).map { |i| gets.chomp.split.map(&:to_i) }

x = []
x << [0, 0, 0]

N.times do |i|
  x << [0, 0, 0]

  3.times do |j|
    3.times do |k|
      next if j == k
      c = x[-2][j] + X[i][k]
      x[-1][k] = c if c > x[-1][k]
    end
  end
end

print x[N].max
