import sys

from fractions import gcd

from itertools import groupby as gb

from itertools import permutations as perm

from itertools import combinations as comb

from collections import Counter as C

from collections import defaultdict as dd

sys.setrecursionlimit(10**5)

def y(f):

    if f:

        print('Yes')

    else:

        print('No')

def Y(f):

    if f:

        print('YES')

    else:

        print('NO')



n = int(eval(input()))

a = list(map(int,input().split()))

b = list(map(int,input().split()))

c = list(map(int,input().split()))

res = 0

for i in a:

    res += b[i - 1]

for i, j in zip(a, a[1:]):

    if j == i + 1:

        res += c[i - 1]

print(res)
n = int(eval(input()))

a = list(map(int,input().split()))

b = list(map(int,input().split()))

c = list(map(int,input().split()))



res = sum(b)

for i in range(n - 1):

    if a[i] + 1 == a[i + 1]:

        res += c[a[i] - 1]

print(res)

import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd

sys.setrecursionlimit(10**5)


def y(f):
    if f:
        print("Yes")
    else:
        print("No")


def Y(f):
    if f:
        print("YES")
    else:
        print("NO")


n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
res = 0
for i in a:
    res += b[i - 1]
for i, j in zip(a, a[1:]):
    if j == i + 1:
        res += c[i - 1]
print(res)

n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
res = sum(b)
for i in range(n - 1):
    if a[i] + 1 == a[i + 1]:
        res += c[a[i] - 1]
print(res)

-import sys -from fractions import gcd -from itertools import groupby as gb -from itertools import permutations as perm -from itertools import combinations as comb -from collections import Counter as C -from collections import defaultdict as dd - -sys.setrecursionlimit(10**5) - - -def y(f): -    if f: -        print("Yes") -    else: -        print("No") - - -def Y(f): -    if f: -        print("YES") -    else: -        print("NO") - - -res = 0 -for i in a: -    res += b[i - 1] -for i, j in zip(a, a[1:]): -    if j == i + 1: -        res += c[i - 1] +res = sum(b) +for i in range(n - 1): +    if a[i] + 1 == a[i + 1]: +        res += c[a[i] - 1]