f=lambda:list(map(int,input().split()))

n=int(eval(input()))

a,b,c=f(),f(),f()

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

n,a,b,c=f()[0],f(),f(),f()

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

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

-n = int(eval(input())) -a, b, c = f(), f(), f() +n, a, b, c = f()[0], f(), f(), f()