object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt()
  val A1, A2 = List.fill(N)(sc.nextInt())
  println {
    A1.scan(0)(_ + _)
      .tail
      .zip(A2.scan(A2.sum)(_ - _).init)
      .map { case (l, r) => l + r }
      .max
  }
}
