import numpy as np

N = int(eval(input()))

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

A = list(np.array(A) - 1)

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

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



sum_ = 0

diff = list(np.array(A[1:]) - np.array(A[:-1]))

diff.insert(0, -1)

for i in range(N):

  sum_ += B[A[i]]

  

  if diff[i] == 1:

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

  

print(sum_)
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 i in range(len(A)):

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



  if i != 0:

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

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



print(ans)
import numpy as np

N = int(eval(input()))
A = list(map(int, input().split()))
A = list(np.array(A) - 1)
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sum_ = 0
diff = list(np.array(A[1:]) - np.array(A[:-1]))
diff.insert(0, -1)
for i in range(N):
    sum_ += B[A[i]]
    if diff[i] == 1:
        sum_ += C[A[i - 1]]
print(sum_)

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 i in range(len(A)):
    ans += B[A[i] - 1]
    if i != 0:
        if A[i - 1] + 1 == A[i]:
            ans += C[A[i - 1] - 1]
print(ans)

-import numpy as np - -A = list(np.array(A) - 1) -sum_ = 0 -diff = list(np.array(A[1:]) - np.array(A[:-1])) -diff.insert(0, -1) -for i in range(N): -    sum_ += B[A[i]] -    if diff[i] == 1: -        sum_ += C[A[i - 1]] -print(sum_) +ans = 0 +for i in range(len(A)): +    ans += B[A[i] - 1] +    if i != 0: +        if A[i - 1] + 1 == A[i]: +            ans += C[A[i - 1] - 1] +print(ans)