fun main(args: Array<String>) {
    val countFood = readLine()!!.toInt()
    val eatOrder = readLine()!!.split(" ").map { it.toInt() - 1 }
    val happiness = readLine()!!.split(" ").map { it.toInt() }
    val bonus = readLine()!!.split(" ").map { it.toInt() }
    var lastEat = -99
    var current = 0

    for (element in eatOrder) {
        if (lastEat == element - 1) {
            current += happiness[element] + bonus[lastEat]
            lastEat = element
        } else {
            current += happiness[element]
            lastEat = element
        }
    }
    print(current)
}