program prob4
    implicit none
    integer :: n, i, m, tmp
    integer, allocatable :: a(:), aa(:)
    read(*,*) n
    allocate(a(n))
    allocate(aa(n))
    read(*,*) a
    read(*,*) aa

    tmp = a(1)
    do i = 1, n
        tmp = tmp + aa(i)
    end do
    m = tmp

    do i = 2, n
        tmp = tmp + a(i)
        tmp = tmp - aa(i-1)
        m = max(m, tmp)
    end do

    write(*,*) m
    deallocate(a)
    deallocate(aa)

    stop
contains
end program prob4