n = gets.chomp.to_i

dp = Array.new(n){Array.new(3, 0)}
a = gets.split.map(&:to_i)
dp[0][0] = a[0]
dp[0][1] = a[1]
dp[0][2] = a[2]
 
(1..(n - 1)).each do |i|
  b = gets.split.map(&:to_i)
  (0..2).each do |j|
    (0..2).each do |k|
    next if k == j
    cost = dp[i - 1][k] + b[j]
    dp[i][j] = cost if cost > dp[i][j]
   end
  end
end
puts [dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]].max