n = gets.to_i

ha, hb, hc = 0, 0, 0
n.times do
	a, b, c = gets.split.map(&:to_i)
	_ha = [hb + a, hc + a].max
	_hb = [ha + b, hc + b].max
	_hc = [ha + c, hb + c].max
	ha, hb, hc = _ha, _hb, _hc
end

p [ha, hb, hc].max
