program main
integer,allocatable :: a(:),b(:),c(:)
integer :: n,ans=0,i
read *,n
allocate(a(n),b(n),c(n-1))
read *,a,b,c

do i = 1,n
ans = ans + b(a(i))
if (a(i) == a(i-1) + 1) then
ans = ans + c(a(i-1))
end if
end do

print *,ans 
end program main