n = STDIN.gets.to_i

activities = Array.new(n)

n.times do |i|
  activities[i] = STDIN.gets.split.map(&:to_i)
end

happiness = Array.new(n) { Array.new(3) }

happiness[0] = activities[0]

for i in 1...n do
  candidates = []
  # choose a
  happiness[i][0] = [activities[i][0] + happiness[i-1][1], activities[i][0] + happiness[i-1][2]].max
  # choose b
  happiness[i][1] = [activities[i][1] + happiness[i-1][0], activities[i][1] + happiness[i-1][2]].max
  # choose c
  happiness[i][2] = [activities[i][2] + happiness[i-1][0], activities[i][2] + happiness[i-1][1]].max
end

p happiness[-1].max
