private fun readInts() = readLine()!!.split(" ").map { it.toInt() }

fun main(args: Array<String>) {
    val (N) = readInts()
    val T = readInts()
    val (M) = readInts()
    val px = (0 until M).map { readInts() }

    for ((p, x) in px) {
        println(T.mapIndexed { index, time -> if (index + 1 == p) x else time }.sum())
    }
}