n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
  
  if num != n and != n - 1:
    if int(a[i]) == int(a[i + 1]):
      m += c[num - 1]
    
print(m)
print(a[0])
