# frozen_string_literal: true

n = gets.to_i
a = []
b = []
c = []
n.times do |i|
  ai, bi, ci = gets.split.map(&:to_i)
  a[i] = ai
  b[i] = bi
  c[i] = ci
end

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

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

puts dp[n - 1].max
