import java.util.Scanner
import scala.math._

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val abc = Array.fill(N, 3)(sc.nextInt)

  val dp = Array.fill(N, 3)(0)

  dp(0) = abc(0)
  for (i <- 1 until N) {
    dp(i)(0) = max(dp(i-1)(1), dp(i-1)(2)) + abc(i)(0)
    dp(i)(1) = max(dp(i-1)(0), dp(i-1)(2)) + abc(i)(1)
    dp(i)(2) = max(dp(i-1)(0), dp(i-1)(1)) + abc(i)(2)
  }
  println(dp.last.max)
}
