object Main extends App {
  val input = io.Source.stdin.getLines.toIndexedSeq.tail
  .map(_.split(' ').map(_.toInt).toIndexedSeq)
  
  val ans = (0 until input(0).size).foldLeft(0){ (acc, i) =>
    val usum = (0 to    i            ).foldLeft(0)( (a,j) => a + input(0)(j) )
    val lsum = (i until input(1).size).foldLeft(0)( (a,j) => a + input(1)(j) )
    val sum = usum + lsum
    Math.max(acc, sum)
  }
  println(ans)
}
