lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a=0
for i in 0..lines[0][0]-1
  a=a+lines[2][lines[1][i]-1]
  if lines[1][i]+1==lines[1][i+1] then
    a=a+lines[3][lines[1][i]-1]
  end
end
puts a