N = gets.to_i
hs = [[0, 0, 0]]
N.times {hs << gets.split.map(&:to_i)}

dp = [[0, 0, 0]]

1.upto(N) do |i|
  dp << [
      [dp[i - 1][1] + hs[i][0], dp[i - 1][2] + hs[i][0]].max,
      [dp[i - 1][0] + hs[i][1], dp[i - 1][2] + hs[i][1]].max,
      [dp[i - 1][0] + hs[i][2], dp[i - 1][1] + hs[i][2]].max
  ]
end

puts dp.last.max