n = gets.chomp.to_i

a, b, c = gets.chomp.split.map(&:to_i)
ka = [a]
kb = [b]
kc = [c]
0.upto(n-2).each do |i|
  a, b, c = gets.chomp.split.map(&:to_i)
  ka.push [kb[i], kc[i]].max + a
  kb.push [kc[i], ka[i]].max + b
  kc.push [ka[i], kb[i]].max + c
end

puts [ka.last, kb.last, kc.last].max
