num = gets.to_i
arr = []
dp = Array.new(num)
num.times do |i|
	arr[i] = gets.split.map(&:to_i)
	dp[i] = Array.new(3, -Float::INFINITY)
end
dp[0] = arr[0]

(num-1).times do |i|
	3.times do |j|
		3.times do |k|
			if j != k
				dp[i+1][k] = [dp[i][j] + arr[i+1][k], dp[i+1][k]].max
			end
		end
	end
end

p dp[num-1].max