vacation_day = gets.to_i
day_point = []

vacation_day.times do |i|
    day_point.push(gets.split(' ').map(&:to_i))
end

dP = Array.new(vacation_day + 1).map{Array.new(3,0)}
dP[1][0] = day_point[0][0]
dP[1][1] = day_point[0][1]
dP[1][2] = day_point[0][2]

range = 2..vacation_day 
range.each do |day|
    
    dP[day][0] = dP[day - 1][1] >= dP[day - 1][2] ? dP[day - 1][1] + day_point[day - 1][0] : dP[day - 1][2] + day_point[day - 1][0]
    dP[day][1] = dP[day - 1][0] >= dP[day - 1][2] ? dP[day - 1][0] + day_point[day - 1][1] : dP[day - 1][2] + day_point[day - 1][1]
    dP[day][2] = dP[day - 1][0] >= dP[day - 1][1] ? dP[day - 1][0] + day_point[day - 1][2] : dP[day - 1][1] + day_point[day - 1][2]

end

p dP.last.max