object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a1, a2 = Array.fill(n)(sc.nextInt())
  val b1 = a1.scanLeft(0)(_ + _).tail
  val b2 = a2.scanRight(0)(_ + _).init
  val ans = b1.zip(b2).map{case (x, y) => x + y}.max
  println(ans)
}