program main
integer::n,i,k=0
integer, allocatable::a(:),b(:),c(:)
read*,n
allocate(a(n),b(n),c(n-1))
read*,a,b,c
do i=1,n
k=k+b(a(i))
if(a(i)==a(i-1)+1)then
k=k+c(a(i-1))
end if
end do
print*,k
end program main