n = gets.to_i
as = []
bs = []
cs = []

dp = Array.new(n + 1).map{ Array.new(3, 0) }

n.times {
	a, b, c = gets.split.map &:to_i
	as << a
	bs << b
	cs << c
}

(0...n).each{ |i|
	dp_index = i + 1
	dp[dp_index][0] = [dp[dp_index - 1][1] + as[i], dp[dp_index - 1][2] + as[i]].max
	dp[dp_index][1] = [dp[dp_index - 1][0] + bs[i], dp[dp_index - 1][2] + bs[i]].max
	dp[dp_index][2] = [dp[dp_index - 1][0] + cs[i], dp[dp_index - 1][1] + cs[i]].max
}

puts dp.last.max
