n = gets.to_i
acti = Array.new(n).map{Array.new(3,0)}
for i in 0..n-1
  acti[i] = gets.chomp.split(" ").map(&:to_i)
end
dp = Array.new(n).map{Array.new(3,0)}
for i in 0..2
  dp[0][i] = acti[0][i]
end
for i in 1..n-1
  for j in 0..2
    if (dp[i-1][(j-1)%3]+acti[i][j]) < (dp[i-1][(j+1)%3]+acti[i][j])
      dp[i][j] = (dp[i-1][(j+1)%3]+acti[i][j])
    else
      dp[i][j] = (dp[i-1][(j-1)%3]+acti[i][j])
    end
  end
end
ans = 0
for i in 0..2
  if ans < dp[-1][i]
    ans = dp[-1][i]
  end
end
puts ans
