n = gets.to_i
a = []
b = []
c = []
n.times do
  params = gets.split.map(&:to_i)
  a << params[0]
  b << params[1]
  c << params[2]
end

dp = Array.new(n) { Array.new(3, 0) }
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

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

puts [dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]].max
