N = gets.to_i
a = Array.new(N)
b = Array.new(N)
c = Array.new(N)

1.upto(N).each {|i|
  ai, bi, ci = gets.split.map(&:to_i)
  a[i] = ai
  b[i] = bi
  c[i] = ci
}

A = 0
B = 1
C = 2

# dp[i][j] i 日目の行動が j だった場合の最大の幸福度 (選択できない場合は -1)
dp = Array.new(N + 1) { Array.new(3, 0) }
dp[0][A] = 0
dp[0][B] = 0
dp[0][C] = 0

1.upto(N) {|i|
  h = i - 1
  ap = dp[h][A]
  bp = dp[h][B]
  cp = dp[h][C]

  dp[i][A] = (bp < cp ? cp : bp) + a[i]
  dp[i][B] = (ap < cp ? cp : ap) + b[i]
  dp[i][C] = (ap < bp ? bp : ap) + c[i]
}

puts dp.last.max
