require 'pp'

N = readline.to_i
H = N.times.each.map do |i|
  readline.split.map(&:to_i)
end

dp = Array.new(N) { Array.new(3,0) }

dp[0][0] = H[0][0]
dp[0][1] = H[0][1]
dp[0][2] = H[0][2]

(1..(N-1)).each do |i|
  a = dp[i-1][0]
  b = dp[i-1][1]
  c = dp[i-1][2]
  dp[i][0] = H[i][0] + (b > c ? b : c)
  dp[i][1] = H[i][1] + (a > c ? a : c)
  dp[i][2] = H[i][2] + (b > a ? b : a)
end

puts dp[N-1].max
