n = int(eval(input()))

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

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

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



ans = 0



for a in A:

    ans += B[a-1]



for i in range(n-1):

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

        ans += C[A[i]-1]



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

a = [i-1 for i in map(int, input().split())]

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

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



ans = 0

prev_ind = 50

for i in a:

    ans += b[i]

    if prev_ind + 1 == i:

        ans += c[prev_ind]

    prev_ind = i



print(ans)
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for a in A:
    ans += B[a - 1]
for i in range(n - 1):
    if A[i] + 1 == A[i + 1]:
        ans += C[A[i] - 1]
print(ans)

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

-A = list(map(int, input().split())) -B = list(map(int, input().split())) -C = list(map(int, input().split())) +a = [i - 1 for i in map(int, input().split())] +b = list(map(int, input().split())) +c = list(map(int, input().split())) -for a in A: -    ans += B[a - 1] -for i in range(n - 1): -    if A[i] + 1 == A[i + 1]: -        ans += C[A[i] - 1] +prev_ind = 50 +for i in a: +    ans += b[i] +    if prev_ind + 1 == i: +        ans += c[prev_ind] +    prev_ind = i