n = gets.chomp.to_i
a, b, c, ma, mb, mc = [], [], [], [], [], []
a[0], b[0], c[0] = gets.chomp.split.map(&:to_i)
ma[0], mb[0], mc[0] = a[0], b[0], c[0]
n.times do |i|
  next if i == 0
  a[i], b[i], c[i] = gets.chomp.split.map(&:to_i)
  ma[i] = a[i] + [mb[i-1], mc[i-1]].max
  mb[i] = b[i] + [mc[i-1], ma[i-1]].max
  mc[i] = c[i] + [ma[i-1], mb[i-1]].max
end
puts [ma[n-1], mb[n-1], mc[n-1]].max
