#include <bits/stdc++.h>
int main() {
  int n;
  int ans;
  int a[60], b[60], c[60];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 0; i < n; i++) {
    ans += b[a[i]];
  }
  printf("%d", ans);
  return 0;
}
