program ABC087C
    implicit none
    integer(8)::N,i,j
    integer(8),allocatable,dimension(:,:)::A,dp
    read*,N
    allocate(A(N,2))
    allocate(dp(N,2))
    read*,A
    dp=0

    do i=1,2
        do j=1,N
            if(i==1)then
                if(j==1)then
                    dp(j,i)=A(j,i)
                else
                    dp(j,i)=dp(j-1,i)+A(j,i)
                end if
            else
                if(j==1)then
                    dp(j,i)=dp(j,i-1)+A(j,i)
                else
                    dp(j,i)=max(dp(j-1,i),dp(j,i-1))+A(j,i)
                end if
            end if
        end do
    end do

    print'(i0)',dp(N,2)
end program ABC087C