N = gets.to_i
dpa = Array.new(N + 1, 0)
dpb = Array.new(N + 1, 0)
dpc = Array.new(N + 1, 0)
N.times do |i|
  a, b, c = gets.split.map(&:to_i)
  dpa[i+1] = dpb[i] + a > dpc[i] + a ? dpb[i] + a : dpc[i] + a
  dpb[i+1] = dpa[i] + b > dpc[i] + b ? dpa[i] + b : dpc[i] + b
  dpc[i+1] = dpa[i] + c > dpb[i] + c ? dpa[i] + c : dpb[i] + c
end
puts [dpa[N], dpb[N], dpc[N]].max