fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    val c = readLine()!!.split(" ").map { it.toInt() }

    val getC = mutableSetOf<Int>()
    a.reduce { a,b -> if(a+1==b) getC.add(a); b }
    b.sum() + c.filterIndexed { i, x -> i+1 in getC }.sum()

})