{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad
import           Data.Array.Unboxed

main :: IO ()
main = print =<< solve <$> getInput

getInput :: IO (Int, UArray (Int, Int) Int)
getInput = do
  n <- readLn
  arr <- readArray 2 n
  return (n, arr)

readArray :: Int -> Int -> IO (UArray (Int, Int) Int)
readArray x y = array ((1, 1), (x, y)) <$> readAssocList x y

readAssocList :: Int -> Int -> IO [((Int, Int), Int)]
readAssocList x y = zip
  [(i, j) | i <- [1 .. x], j <- [1 .. y]]
  <$> readMat x y

readMat :: Int -> Int -> IO [Int]
readMat x y = concat <$> replicateM x readInts

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: (Int, UArray (Int, Int) Int) -> Int
solve (n, ass) = maximum [turnAt i | i <- [1 .. n]] where
  turnAt x = sum [ass ! (1, i) | i <- [1 .. x]]
               + sum [ass ! (2, i) | i <- [x .. n]]
