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

dp = Array.new(N)
N.times.each { |i| dp[i] = Array.new(3, 0) }
dp[0][0] = point_list[0][0]
dp[0][1] = point_list[0][1]
dp[0][2] = point_list[0][2]

(1...N).each do |i|
  a_, b_, c_ = dp[i - 1]
  a, b, c  = point_list[i]
  dp[i][0] = [b_, c_].map { |n| n + a }.max
  dp[i][1] = [a_, c_].map { |n| n + b }.max
  dp[i][2] = [a_, b_].map { |n| n + c }.max
end

puts dp[N - 1].max
