program ya
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,ans=0
    integer(int32), allocatable:: a(:),b(:),c(:)

    read*, n
    allocate(a(n), b(n), c(n-1))
    read*, a(:)
    read*, b(:)
    read*, c(:)

    do i=1,n
        ans=ans+b(a(i))
    end do
    do i=1,n-1
        if (a(i)+1==a(i+1)) ans=ans+c(a(i))
    end do
    print'(i0)', ans
end program ya