n = gets.to_i
abc = []
n.times do |i|
  a, b, c = gets.split(' ').map(&:to_i)
  abc << { a: a, b: b, c: c }
end
dp = [
  { a: 0, b: 0, c: 0 }
]

0.upto(n-1) do |i|
  a = [dp[i][:b] + abc[i][:a], dp[i][:c] + abc[i][:a]].max
  b = [dp[i][:a] + abc[i][:b], dp[i][:c] + abc[i][:b]].max
  c = [dp[i][:a] + abc[i][:c], dp[i][:b] + abc[i][:c]].max
  dp[i+1] = { a: a, b: b, c: c }
end

puts [dp[n][:a], dp[n][:b], dp[n][:c]].max
