N=gets.to_i

actions = []
N.times do |n|
  actions << gets.split.map(&:to_i)  
end

dp_a = Array.new(N+1, 0)
dp_b = Array.new(N+1, 0)
dp_c = Array.new(N+1, 0)

N.times do |n|
  # a
  dp_a[n+1] = actions[n][0] + [dp_b[n], dp_c[n]].max
  # b
  dp_b[n+1] = actions[n][1] + [dp_a[n], dp_c[n]].max
  # c
  dp_c[n+1] = actions[n][2] + [dp_a[n], dp_b[n]].max
end

puts [dp_a[N], dp_b[N], dp_c[N]].max
