let i_inp_list : unit -> int list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.map (fun x -> int_of_string x) (inp_split)

let i_inp_array : 'a array -> int -> unit = fun a n ->
  let rec loop i = 
    if i = n then ()
    else
      (a.(i) <- (Scanf.scanf " %d" (fun x -> x));
       loop (i + 1))
  in loop 0

let () =
  let n = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let a = i_inp_list () in
  let b = Array.make n 0 in
  let c = Array.make (n-1) 0 in
  i_inp_array b n;
  i_inp_array c (n-1);
  let rec loop = function
  	[] -> 0
  | [x] -> b.(x-1)
  | (x::y::xs) -> if(x + 1 = y) 
						  then b.(x-1) + c.(x-1) + loop (y::xs)
  						else b.(x-1) + loop (y::xs)
  in 
  let ans = loop a in
  print_int ans;
  print_newline ()
  t_newline ()