import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val list = mutableListOf<Int>()
    for (i in 0 until n) {
        list.add(scanner.nextInt())
    }

    val m = scanner.nextInt()
    val pxList = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until m) {
        pxList.add(scanner.nextInt() to scanner.nextInt())

    }

    pxList.forEach { pair ->
        var basevalue = 0
        list.forEachIndexed { index, value ->
            if (index + 1 == pair.first) {
                basevalue = list[index]
                list[index] = pair.second
            }
        }
        println(list.sum())
        list[pair.first -1] = basevalue
    }
}

