n=gets.to_i
abc=[]
n.times do|i|
	abc[i]=gets.chomp.split(" ").map(&:to_i)
end
dp=Array.new(n)
flag=-1
way1=abc[0][0]
way2=abc[0][1]
way3=abc[0][2]
if way1>way2 and way1>way3
	dp[0]=way1
	flag=0
elsif way2>way1 and way2>way3
	dp[0]=way2
	flag=1
else
	dp[0]=way3
	flag=2
end
for i in 1..n-1
	max=0
	tmp_flg=-1
	for j in 0..2
		if j==flag
			next
		end
		result=dp[i-1]+abc[i][j]
		if(max<result)
			max=result
			tmp_flg=j
		end
	end
	flag=tmp_flg
	dp[i]=max
end
p dp[n-1]