<?php
$n = fgets(STDIN); 
$a = explode(" ", fgets(STDIN)); 
$b = explode(" ", fgets(STDIN)); 
$c = explode(" ", fgets(STDIN)); 
$fact = 0;
$j = 0;

for($i = 0; $i < $n; $i++){
  if($i == 0){
    $fact = $b[$a[$i] - 1];
	$j++;
  } else {
    if($a[$i] > $a[$i - 1]){
      $fact = $fact + $b[$a[$i] - 1] + $c[$j];
 	  $j++;
    } else {
      $fact = $fact + $b[$a[$i] - 1];
      $j++;
    }
  }
}

    echo $fact;

?>