fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val t = readLine()!!.split(" ").map { it.toInt() }
    val m = readLine()!!.toInt()
    val px = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }

    val time = t.sum()
    px.map { d ->
        val (p,x) = d
        time - t[p-1] + x
    }.joinToString("\n")

})
