n = gets.to_i
dp = { a: Array.new(n, 0), b: Array.new(n, 0), c: Array.new(n, 0) }
n.times do |i|
  a, b, c = gets.chomp.split.map(&:to_i)
  if i == 0
    dp[:a][0] = [b, c].max
    dp[:b][0] = [c, a].max
    dp[:c][0] = [a, b].max
  else
    dp[:a][i] = dp[:a][i - 1] + [b, c].max
    dp[:b][i] = dp[:b][i - 1] + [c, a].max
    dp[:c][i] = dp[:c][i - 1] + [a, b].max
  end
end

puts [dp[:a][-1], dp[:b][-1], dp[:c][-1]].max