n = gets.chomp.to_i
k = []
n.times do |i|
  k[i] = gets.chomp.split.map(&:to_i)
end

dp = Array.new(10 ** 5 + 5) { Array.new(3, 0) }
dp[0][0] = 0
dp[0][1] = 0
dp[0][2] = 0

0.upto(n) do |i|
  (0..2).each do |j|
    max = 0
    (0..2).each do |d|
      next if d == j
      tmp = dp[i][d] + k[i-1][d]
      max = tmp if tmp > max
    end
    dp[i+1][j] = max
  end
end
p [dp[n][0], dp[n][1], dp[n][2]].max
